date format (UK)
-
I'm using the following so I can format all my dates relvant to the current culture of the OS. The app is for global use private DateTimeFormatInfo dtFormatInfo; this.dtFormatInfo = Thread.CurrentThread.CurrentUICulture.DateTimeFormat; I have then created a property to format any dates in ShortDatePattern public string ShortDateFmt { get { return this.dtFormatInfo.ShortDatePattern; } } Every time I run my application and process a date it returns in the format mm\dd\yyyy when running on an OS with United Kingdom setup (en-GB). en-GB date format should be dd/mm/yyyy I have even created the follwing property so as to debug and check the CurrentUICulture public string CurrentUICultureName { get { return Thread.CurrentThread.CurrentUICulture.Name; } } and this is returning en-GB. Any suggestions as to why the date is not formatting for en-GB
-
I'm using the following so I can format all my dates relvant to the current culture of the OS. The app is for global use private DateTimeFormatInfo dtFormatInfo; this.dtFormatInfo = Thread.CurrentThread.CurrentUICulture.DateTimeFormat; I have then created a property to format any dates in ShortDatePattern public string ShortDateFmt { get { return this.dtFormatInfo.ShortDatePattern; } } Every time I run my application and process a date it returns in the format mm\dd\yyyy when running on an OS with United Kingdom setup (en-GB). en-GB date format should be dd/mm/yyyy I have even created the follwing property so as to debug and check the CurrentUICulture public string CurrentUICultureName { get { return Thread.CurrentThread.CurrentUICulture.Name; } } and this is returning en-GB. Any suggestions as to why the date is not formatting for en-GB
The ShortDatePattern does not specify the date separator, so when you use a pattern from a culture other than the current culture, the separator will still be taken from the current culture. Use the CultureInfo object or DateTimeFormat object to format the date instead. They also contain information about the date separator. --- b { font-weight: normal; }