I have a Windows Server 2008 R2 system that is configured with default locale settings (no format overrides or anything else) and it is installed in en-US.
When I interrogate the following: System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat
It displays DateSeparator as - (dash) instead of // slash. Therefore, DateTime.Now.ToString () will look something like this:
01-30-2015.
In addition, CurrentThread.CurrentCulture.ToString () = "en-US"
I totally don’t understand how possible this is, but more importantly, I would like to know if .NET has some kind of local override that is somehow configurable?
The settings for the region and system language are normal and not changed. Any help would be greatly appreciated, thanks.
Here is the diagnostic information code. It runs in asp.net on the aspx page.
Current Date Time: <%= DateTime.Now.ToString() %> Current Short Date: <%= DateTime.Now.ToShortDateString() %> Current Culture: <%= System.Threading.Thread.CurrentThread.CurrentCulture.ToString() %> Current UI Culture: <%= System.Threading.Thread.CurrentUICulture.ToString() %> DateTimeFormatInfo invariant = CultureInfo.InvariantCulture.DateTimeForamat; DateTimeFormatInfo uiThread = System.Threading.Thread.CurrentThread.CurrentUICulture.DateTimeFormat; DateTimeFormatInfo thread = System.Threading.Thread.CurrentThread.CurrentCulture.DateTimeFormat; Type type = System.Threading.Thread.CurrentThread.CurrentUICulture.DateTimeFormat.GetType(); foreach( var prop in type.GetProperties()) { <%= prop.Name %> <%= prop.GetValue(invariant, null) %> <br/> <%= prop.GetValue(uiThread, null) %> <br/> <%= prop.GetValue(thread, null) %> <br/> }
Region and language settings 
See below for more information. 
source share