Thursday, 12 May 2011

IIS .NET globalization settings affecting date displays

I had a strange problem today - a site I recently deployed to live from my local dev environment was displaying dates in American formay (mm/dd/yyyy), yet when running locally it was fine (dd/mm/yyyy). At first I thought I must have had the wrong default language for the db user, but everything was as it should be.

Later I discovered that the live website in IIS had a culture setting of "Invariant Language (Invariant Country)". Changing this to "English (United Kingdom) (en-GB)" resolved the problem. It adds an entry to the system.web entry your web.config like so:

globalization culture="en-GB"

I don't recall ever having to do this before, and this entry isn't present in my local webconf, but it's one I'll look out for in the future.

1 comment:

  1. I discover this new feature on IIS7 today too. I had problem with SQL money format.

    ReplyDelete

Comments are moderated, so you'll have to wait a little bit before they appear!