How to concatenate a datetime into a textbox in c# asp.net to show just date -


how concatenate nullable datetime textbox in c# asp.net show date? when load date textbox below in textbox:

2014-04-26 00:00:00.000

but want date ideas? cant tostring display want. calling value below:

 txtdateexpected.text = loadvisitdetails.expecteddate.tostring(); 

you can date part using date property of datetime class:

 txtdateexpected.text = loadvisitdetails.expecteddate != null ? loadvisitdetails.expecteddate.date.tostring() : ""; 

or:

if(loadvisitdetails.expecteddate != null)    txtdateexpected.text = loadvisitdetails.expecteddate.date.tostring(); 

check here datetime.date msdn docs


Comments

Popular posts from this blog

How to access named pipes using JavaScript in Firefox add-on? -

multithreading - OPAL (Open Phone Abstraction Library) Transport not terminated when reattaching thread? -

node.js - req param returns an empty array -