When setting Culture, can I override the date format to e.g. mm/dd/yyyy?
asp.net-mvc, c#, datetime
Solution
First of all you need to create an instance of `CultureInfo` that won't be read only. Then you can create an instance of your `DateTimeFormatInfo`, configure it appropriately and finally assign it to your `CultureInfo` object:
var culture = CultureInfo.CreateSpecificCulture("en-US");
//or simply var culture = new CultureInfo("en-US");
var dateformat = new DateTimeFormatInfo();
//then for example:
dateformat.FullDateTimePattern = "dddd, mmmm dd, yyyy h:mm:ss tt";
culture.DateTimeFormat = dateformat;
System.Threading.Thread.CurrentThread.CurrentCulture = culture;
The full specification on how to configure your DateTimeFormatInfo can be found here.
Problem
When I set the CurrentCulture, how can I override the date format that is set? Example: ``` System.Threading.Thread.CurrentThread.CurrentCulture = CultureInfo.GetCultureInfo("en-US"); ``` Say I wanted to override the default date format so whenever I output DateTime value it is by default in the format I want.