• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 388
  • Last Modified:

Problem with browser displaying dates

I have a strange problem in one page.
In my local environment (Classic ASP) the date that is displayed on the page coming from the database shows as:  20/02/2013, when I upload it to my live environment it shows (02/20/2013), the second is the way it SHOULD be.

This started happening since I updated my local computer to win 8.  It is the exact same ASP yet locally displays the date differently. So it is not the code of the ASP. All files are the same.
0
Aleks
Asked:
Aleks
  • 17
  • 9
  • 4
  • +1
13 Solutions
 
AleksAuthor Commented:
It actually happens on ALL pages of the system, any page that displays dates shows the day first instead of the month. This only happens locally  :$
0
 
Dave BaldwinFixer of ProblemsCommented:
In previous versions of Windows, the "Regional and Language" feature in the Control Panel allows you to set the date time formats you want to use.  If you can change it there, that might fix the problem you're seeing.
0
 
AleksAuthor Commented:
I checked and changed but that didn't work ... any other ideas ?
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Dave BaldwinFixer of ProblemsCommented:
No, sorry.  You can click on "Request Attention" to get some others to look at your question.
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
try the following steps:

1) Change the datetime format of your server as DB described:

Control Panel -> Regional and Language Options -> Advanced
(if you already have, skip this step)

2) Open IIS and follow below steps: (For IIS7)

- Click on you Website
- Select .NET GLOBALIZATION option
- From Culture tab, select required Culture and UI Culture.
- Finally iisreset.
0
 
AleksAuthor Commented:
Still no luck  :(  

I am even using a script to display the date in a specific format and it is being overrided by windows or sql 2008
0
 
AleksAuthor Commented:
Also, this is not a browser issue because I tried witn Internet explorer and Chrome and get the same result
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
you may have to look in the registry then:

Open Regedit and make sure the following sShortDate registry key is set
to m/d/yyyy:

HKEY_CURRENT_USER\Control Panel\International

HKEY_USERS\.DEFAULT\Control Panel\International

HKEY_USERS\S-1-5-18\Control Panel\International

HKEY_USERS\S-1-5-19\Control Panel\International

HKEY_USERS\S-1-5-20\Control Panel\International
0
 
AleksAuthor Commented:
I did all the above .. no luck !
example.gif
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
did you do an iisreset? maybe a reboot?
0
 
AleksAuthor Commented:
I did reboot my computer, no luck. Still displaying EVERY date as dd/mm/yyyy causing all sort of issues :(
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
i'm out of ideas, Request Attention so other experts can have a look
0
 
AleksAuthor Commented:
How do I request attention ?
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
there's a link under the original post
0
 
AleksAuthor Commented:
Thanks just did
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Are you outputting the date directly from the db
response.write rs("somedate")

Open in new window

Try
response.write formatdatetime(rs("somedate"),2)

Open in new window

0
 
AleksAuthor Commented:
I am outputting from the database AND formatting the date. Regardless of the format I give to the date it will display it as dd/mm/yyyy
0
 
AleksAuthor Commented:
After changing the settings in my computer as recommended above, my date in the windows bottom bar now shows:  3/d/yyyy  instead of the actual date, how to fix this back ?

---

Open Regedit and make sure the following sShortDate registry key is set
to m/d/yyyy:

HKEY_CURRENT_USER\Control Panel\International

HKEY_USERS\.DEFAULT\Control Panel\International

HKEY_USERS\S-1-5-18\Control Panel\International

HKEY_USERS\S-1-5-19\Control Panel\International

HKEY_USERS\S-1-5-20\Control Panel\International
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
When you open up IIS, go to your site, click on ASP, what is the Local ID set to?  

http://support.microsoft.com/kb/229690  It is probably zero meaning the default.  Try changing it to 1033 for English (United States).  If that is the fix, your computer is probably set to a time zone for another country.  

What happens when you run this code?
<%
response.write Month(now())&"<br>"
response.write day(now())&"<br>"
response.write year(now())&"<br>"
response.write formatdatetime(now(),2)&"<br>"
response.write now() &"<br>"
response.write rs("date") &"<br>"
response.write month(cdate(rs("date"))) &"<br>"
response.write day(cdate(rs("date"))) &"<br>"
response.write year(cdate(rs("date"))) &"<br>"

%>
0
 
AleksAuthor Commented:
This is the page code:

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Untitled Document</title>
</head>

<body>

<%
response.write Month(now())&"<br>"
response.write day(now())&"<br>"
response.write year(now())&"<br>"
response.write formatdatetime(now(),2)&"<br>"
response.write now() &"<br>"
response.write rs("date") &"<br>"
response.write month(cdate(rs("date"))) &"<br>"
response.write day(cdate(rs("date"))) &"<br>"
response.write year(cdate(rs("date"))) &"<br>"

%>
</body>
</html>


This is what I get:

3
24
2014
m/24/2014
3/24/2014 12:26:46 PM
An error occurred on the server when processing the URL. Please contact the system administrator.
If you are the system administrator please click here to find out more about this error.
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
"m/24/2014" Is that a finger slip? or did you copy/paste?  m should be 3.  
 
"An error occurred on the server when ...." I was assuming you would pull the date from your database. I made up the rs("date")

Based on the first part of the response. your computer is set fine.   Please try this again but use your database for the date.  Remove all javascript.
0
 
AleksAuthor Commented:
I copy pasted it, that is what it reads.
0
 
AleksAuthor Commented:
I tested and it shows up fine here :$ .... the issue must be in an include file I have on those pages. I will check on this thanks for all your help. One issue remains though when I messed with my registry. How can I set It back to the way it was ?  (Read above)
0
 
Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
Big Monty will have to help you on the registry.  I can see now that is why you came up with the M "m/24/2014".  For future, I don't think the registry is something to muck with unless you 100% sure you know what you are doing.   You can just as easily change the time and zone through the control panel.  

As far as trouble shooting goes, it is best to strip everything out and keep adding until you can see what is changing the format of your date.  

It would have helped from the start to see a short test case of your code, but at least it sounds like you are on the right path.

Perhaps post a new question in the microsoft zone about fixing your registry if Big Monty does not come back.
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
I should have prefaced my registry comment with "do only if you feel comfortable and you know how to make a back up of your registry!", my apologies for not stressing that enough.

I also didn't realize the registry is case sensitive (at least, I now think it is), so you'll need to either change the values to have a capital M (example: sShortDate = M/d/yyyy) or try going into the international settings in the control panel and change the values in there (even if you change it to something else, then back to what you want) and that should resolve the issue. I would try that before editing the registry again.
0
 
AleksAuthor Commented:
Changing it didn't help. My windows date now shows :  49/d/yyyy
screenshot.gif
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
Then I would backup your registry, then delete those registry keys
0
 
AleksAuthor Commented:
I deleted the values, that didn't work.   it now shows 16/d/yyyy  

Can anyone check the values of the registry in your own computer so I can set it to that ?

Apparently this are the entries that were changed:

Open Regedit and make sure the following sShortDate registry key is set
to m/d/yyyy:

HKEY_CURRENT_USER\Control Panel\International

HKEY_USERS\.DEFAULT\Control Panel\International

HKEY_USERS\S-1-5-18\Control Panel\International

HKEY_USERS\S-1-5-19\Control Panel\International

HKEY_USERS\S-1-5-20\Control Panel\International
0
 
AleksAuthor Commented:
I added a couple more clocks, this is what is displayed after entering:  MM/dd/yyyy  in all the keys above.
0
 
AleksAuthor Commented:
screenshot
dates.gif
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
Open Regedit and make sure the following sShortDate registry key is set
to m/d/yyyy:

no, I said to change it to M/d/yyyy - with a capital M

can you send a screen shot of the window that open when you go to

Control Panel -> Region & Languages. It should look something similar to the attached image

If you find this window, change the short date to something else (doesnt matter what) save, re-open it and change it back.
Untitled.png
0
 
Big MontySenior Web Developer / CEO of ExchangeTree.org Commented:
just curious, are the dates displaying properly now?
0

Featured Post

[Webinar] Database Backup and Recovery

Does your company store data on premises, off site, in the cloud, or a combination of these? If you answered “yes”, you need a data backup recovery plan that fits each and every platform. Watch now as as Percona teaches us how to build agile data backup recovery plan.

  • 17
  • 9
  • 4
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now