Link to home
Start Free TrialLog in
Avatar of searchsanjaysharma
searchsanjaysharma

asked on

How to change date format in DD-MMM-YYYY

I have the following date and time in

      
2/16/2012 1:42:04 PM

The date should come as dd-mm-yyyy

this is code  i m using string a = DateTime.Now.ToString();
Avatar of Member_2_99151
Member_2_99151

Hi,

You should be able to use this:

String s = DateTime.Now.ToString("dd-MM-yyyy");

Open in new window


Hope this helps,

James
Avatar of searchsanjaysharma

ASKER

I need time also. in hh:mm:ss which should refresh automatically and i am using asp.net framework 2.0
ASKER CERTIFIED SOLUTION
Avatar of Member_2_99151
Member_2_99151

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
for time, 'HH' makes it 24 hour. you can use 'hh' if you're only interested in 12 hour...
tHANKS
No problem :-)