为什么Thread.CurrentThread.CurrentCulture.Name显示“en-US”当我的服务器的区域语言设置为英语(英国) [英] Why is Thread.CurrentThread.CurrentCulture.Name showing "en-US" when my server's regional language is set to English (United Kingdom)
问题描述
DateTime.ToString(dd / MM / yyyy)
),但是我想知道,在实时服务器上的其他操作系统设置是否导致这种差异?我也看过这个问题,但似乎没有回答我的问题。
一些额外的信息:在开发,测试和分期环境中
Syste m.Threading.Thread.CurrentThread.CurrentUICulture.Name =en-US
System.Threading.Thread.CurrentThread.CurrentCulture.Name =en-GB
在现场环境中
System.Threading.Thread.CurrentThread.CurrentUICulture.Name =en-US
System.Threading.Thread.CurrentThread.CurrentCulture.Name =en-US
您是否检查了 > web.config
?
你可以这样声明地设置它:
< worldwide uiCulture =en-GBculture =en-GB/>
请参阅: http://msdn.microsoft.com/en-us/library/bz9tc508.aspx
I have a Web Application which at various points makes users enter dates and also displays dates to users. When debugging (and when the site is running on our test and staging servers) the date formats appear in dd/mm/yyyy format (when using DateTime.ToShortDateString()). These servers (and my dev environment have "English (United Kingdom)" set as the language under the windows regional options. All good so far. However, on the live server dates appear in the format mm/dd/yyyy even though the live server still has the language set to "English (United Kindgom)". I've seen this question which explains how to parse the date in a specific format and I already know how to get the date in the required string format (DateTime.ToString("dd/MM/yyyy")
) but am wondering what other OS setting on the live server is causing this discrepancy?
I've also seen this question, but it doesn't seem to answer my question.
Some additional information: on the dev, test and staging environments System.Threading.Thread.CurrentThread.CurrentUICulture.Name="en-US" System.Threading.Thread.CurrentThread.CurrentCulture.Name="en-GB"
And on the live environment System.Threading.Thread.CurrentThread.CurrentUICulture.Name="en-US" System.Threading.Thread.CurrentThread.CurrentCulture.Name="en-US"
Have you checked the globalization
section of web.config
?
You can set it declaratively like so:
<globalization uiCulture="en-GB" culture="en-GB" />
See: http://msdn.microsoft.com/en-us/library/bz9tc508.aspx
这篇关于为什么Thread.CurrentThread.CurrentCulture.Name显示“en-US”当我的服务器的区域语言设置为英语(英国)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!