0

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

2
  • Can you provide the code for printing the date?
    – Dai Bok
    Jan 2, 2014 at 22:11
  • 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
    Jan 2, 2014 at 22:28

1 Answer 1

0

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

3
  • You have to select the correct culture, those are just sample cultures. Based on the format you want. It is possible you want to set both as culture="en-US" uiCulture="en-US". Additionally this will provide some sample to test support.microsoft.com/kb/306162 –
    – Dalorzo
    Jan 2, 2014 at 23:58
  • There doesn't seem to be any effect of changing culture on the resultant date time format. I tried fr-CA and en-Us and others. But the dates don't change.
    – kulNinja
    Jan 3, 2014 at 16:02
  • I have done this in the past, I have seen it working in this way. Did you try the sameple code on the link?
    – Dalorzo
    Jan 3, 2014 at 16:04

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.