on a developer machine (cassini)

new DateTime(2012,3,14).ToString("d")

results in

14/03/2012

which is correct but when deployed to a full IIS server the result is

03/14/2012

The server is set in control panel/Region language to all English/UK/GB, running date in command prompt returns the dd/MM/YYYY format.

The site is set for both uiCulture="en-GB" and culture="en-GB" and these show in the web.config globalization tag.

I can work around this issue by adding a forced culture

new DateTime(2012,3,14).ToString("d", new CultureInfo("en-GB"));

but I would really like to know what is setting the format incorrectly.

CultureInfo.CurrentCulture.Name, CultureInfo.CurrentUICulture.Name

both return en-US


  • en-US: M/d/yyyy (e.g. 3/14/2012)
  • en-GB: dd/MM/yyyy (e.g. 14/03/2012)

Actual value in web.config

 <globalization requestEncoding="UTF-8" responseEncoding="UTF-8" uiCulture="en-GB" culture="en-GB" />
Edit
Report