Click here to Skip to main content
15,916,042 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to convert date dd-mm-yy to mm/dd/yyyy in c#
thanks in advance
Posted
Comments
dan!sh 16-Nov-11 1:54am    
Where and why do you want to format it?
Mehdi Gholam 16-Nov-11 1:55am    
Have you tried ToString() on the date?

Use Culture.. for specific formats
Go through This
 
Share this answer
 
v2
DateTime dt=DateTime.Now
dt.ToString(FORMAT) 

FORMAT
1. "dd/MMM/yyyyy"
2. "ddd/MMM/yyyyy"
 
Share this answer
 
Try this

C#
DateTime date1 = new DateTime(2011, 08, 04);

string myDate = date1.ToString("MM/dd/yyyy g",CultureInfo.InvariantCulture);
// Displays 08/04/2011 A.D. 
 
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