Feb
05
You can easily change the default culture (which controls date/time formatting) in the Page directive or web.config. But you can’t easily set the date/time format to a custom value without editing the localization settings on the web server itself. If you don’t have access to this, or if you want to more easily deploy your application without changing system settings, you can use code like this. Feel free to copy and paste. Replace the literal strings with the appropriate call to ConfigurationManager.AppSettings if you’d like to use web.config.
protected void Application_BeginRequest(object sender, EventArgs e) {
var activeThread = System.Threading.Thread.CurrentThread;
var culture = new CultureInfo("en-US");
var timeFormat = new DateTimeFormatInfo();
timeFormat.ShortDatePattern = "ddd MMM dd";
timeFormat.LongDatePattern = "ddd MMM dd h:mm tt";
culture.DateTimeFormat = timeFormat;
activeThread.CurrentCulture = culture;
}
no comment until now