Reputation: 125
I've created an application in ASP.NET MVC4. Everything is ok on my Visual Studio 2012 IIS Server. The problem is when i publish it on Azure, then when i call DateTime.Now
i got time from other time zone than mine and also when i want to display date : DateTime.Now.ToString("dd MMMM yyyy")
month name is in english. How can I specific culture (i.e. pl-PL) in a whole application?
I've tried <Globalization Culture="pl-PL" UICulture="pl-PL" />
in web.config but with no effect
Upvotes: 1
Views: 1759
Reputation: 241728
DateTime.Now
in a server application. That imposes the time zone of the server into the results. There is no good reason for that - you should be able to deploy your application anywhere. Read more here.Culture
setting affects the output of DateTime.ToString()
. The UICulture
doesn't matter (for this regard).It's not picking up your values from web.config because it is case sensitive and you are using the incorrect casing. Reference here. You need:
<globalization culture="pl-PL" uiCulture="pl-PL" />
Upvotes: 3