Click here to Skip to main content
15,894,180 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How to convert Date format from dd/MM/yyyy to mm/dd/yyyy in asp.net
Posted

Below code will perform it.

C#
String OriginalDate = "08/30/1999";
DateTime temp = Convert.ToDateTime(OriginalDate.Text);
String ConvertDate = temp.ToString("dd/MM/yyyy"); // or "MM/dd/yyyy"


As the alternative solution, you can set appropriate CurtureInfo to parse your date string to DateTime

Interesting thread at http://forums.asp.net/thread/1557498.aspx[^]
 
Share this answer
 
v2
Comments
Manfred Rudolf Bihy 3-Oct-11 6:17am    
Proposed as solution! 5+
Sergey Alexandrovich Kryukov 3-Oct-11 19:47pm    
Correct, my 5.
--SA
Try as below code.

C#
DateTime dtNow = DateTime.Now;

string MonthDayYear = dtNow.ToString("MM/dd/yyyy");
string DayMonthYear = dtNow.ToString("dd/MM/yyyy");
 
Share this answer
 
use this

datetime.now.tostring("MM/dd/yyyy");


to know all the formats go through this link
http://www.geekzilla.co.uk/View00FF7904-B510-468C-A2C8-F859AA20581F.htm[^]
 
Share this answer
 
v2
This can achieve it:
C#
string strDate = Convert.ToDateTime("01/24/2011").ToString("dd/MM/yyyy");
 
Share this answer
 
 
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