0
votes

I installed an asp.net mvc website from windows 2003 to windows 2008. From start the date format is displayed as m/d/yyyy hh:mm:ss tt when on 2003 it is displayed as yyyy-mm-dd HH:mm:ss enter image description here If I try to run this site through visual studio on 2003 or 2008 or windows 7 or xp, the pages pull correct format but if I run this through IIS, it shows wrong format (m/d/yyyy hh:mm:ss tt ).

I have edited the HKEY_USERS.DEFAULT\Control Panel\International to have desired date format but no luck! enter image description here

I tried changing region and language too... no luck.

enter image description here Any ideas anyone?!

Here is the first call to get the date time... enter image description here

Thanks in advance.

No luck with suggestion: enter image description here

1
Can you provide the code for printing the date? - Dai Bok
Code is provided at the end of question. This code is running on windows 7 machine and not on server so it works as expected. But on server it shows wrong date format. - kulNinja

1 Answers

0
votes

To control the output date format(Culture) I would you suggest to control it at application level in the web.config

This can be easily done trough the globalization element:

<configuration>
   <system.web>
      <globalization culture="en-US" uiCulture="de-DE"/>
   </system.web>
</configuration>

It is possible you want to set both as culture="en-US" uiCulture="en-US". Additionally this will provide some sample code to test http://support.microsoft.com/kb/306162