Thursday, March 11, 2010

How to Globalize the date format Using C#.Net?

using System.Globalization;

CultureInfo culture = (CultureInfo)CultureInfo.CurrentCulture.Clone();
culture.DateTimeFormat.ShortDatePattern = "MM/dd/yyyy";
culture.DateTimeFormat.LongTimePattern = "";
System.Threading.Thread.CurrentThread.CurrentCulture = culture;

Tips:
Add the above code in Program.cs file.

Note:
Tested in windows application.
After include this No need to change anything at anywhere,it will works fine.

No comments:

 
Feedback Form