We help IT Professionals succeed at work.

How to change date format in DD-MMM-YYYY

searchsanjaysharma
on
390 Views
Last Modified: 2012-02-16
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();
Comment
Watch Question

Hi,

You should be able to use this:

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

Open in new window


Hope this helps,

James

Author

Commented:
I need time also. in hh:mm:ss which should refresh automatically and i am using asp.net framework 2.0
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
for time, 'HH' makes it 24 hour. you can use 'hh' if you're only interested in 12 hour...

Author

Commented:
tHANKS
No problem :-)
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.