Click here to Skip to main content
15,867,308 members
Please Sign up or sign in to vote.
3.67/5 (2 votes)
See more:
Hi all

Please tell me how to format the datetime.
i wan tthe format like this

December, 24 2012 and want to display it in a label

Thank you
Posted

Provided you local is en-US (or compatible) then
C#
MyLabel.Text = dt.ToString("MMMM, dd yyyy");

should do the trick (see the documentation[^]).
 
Share this answer
 
Comments
Sergey Alexandrovich Kryukov 24-Dec-12 12:35pm    
Yes, especially if OP finds it tricky to find it out on just one of 3 MSDN pages... a 5.
—SA
Need help? Such help is already written for your:
http://msdn.microsoft.com/en-us/library/system.datetime.aspx[^] (see the methods ToString here),
http://msdn.microsoft.com/en-us/library/az4se3k1.aspx[^],
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx[^].

After looking at this pages, you will see that your problem is quite trivial and will easily solve it.

—SA
 
Share this answer
 
Take datetimepicker. and take current date and assigned it to the label.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900