关闭

convert from dd/mm/yyyy to mm/dd/yyyy in c#

标签: c#string
91人阅读 评论(0) 收藏 举报

Hi All, 

I need to convert dd/mm/yyyy string to valid Datetime using C#. Please help me. It is urgent. 

Thanking you in Advance. 
Bye....
 

PostPosted: Wed Aug 27, 2008 10:37 am    Post subject: Reply with quote

Hi Mouli, 

Try this Code: 

string UrDate = "27/08/2008"; 
System.Globalization.DateTimeFormatInfo dateInfo = new System.Globalization.DateTimeFormatInfo(); 
dateInfo.ShortDatePattern = "dd/MM/yyyy"; 
DateTime validDate= Convert.ToDateTime(toDate, dateInfo); 

validDate will contains the Valid Datetime.. 

0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:9892次
    • 积分:336
    • 等级:
    • 排名:千里之外
    • 原创:29篇
    • 转载:0篇
    • 译文:0篇
    • 评论:0条