Solved

Problem with browser displaying dates

Posted on 2014-03-20
32
367 Views
Last Modified: 2014-03-25
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
Comment
Question by:amucinobluedot
  • 17
  • 9
  • 4
  • +1
32 Comments
 

Author Comment

by:amucinobluedot
ID: 39942929
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
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 78 total points
ID: 39943031
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
 

Author Comment

by:amucinobluedot
ID: 39943154
I checked and changed but that didn't work ... any other ideas ?
0
 
LVL 82

Assisted Solution

by:Dave Baldwin
Dave Baldwin earned 78 total points
ID: 39943202
No, sorry.  You can click on "Request Attention" to get some others to look at your question.
0
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 270 total points
ID: 39943225
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
 

Author Comment

by:amucinobluedot
ID: 39943255
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
 

Author Comment

by:amucinobluedot
ID: 39943260
Also, this is not a browser issue because I tried witn Internet explorer and Chrome and get the same result
0
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 270 total points
ID: 39943274
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
 

Author Comment

by:amucinobluedot
ID: 39943608
I did all the above .. no luck !
example.gif
0
 
LVL 32

Expert Comment

by:Big Monty
ID: 39943610
did you do an iisreset? maybe a reboot?
0
 

Author Comment

by:amucinobluedot
ID: 39943643
I did reboot my computer, no luck. Still displaying EVERY date as dd/mm/yyyy causing all sort of issues :(
0
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 270 total points
ID: 39943646
i'm out of ideas, Request Attention so other experts can have a look
0
 

Author Comment

by:amucinobluedot
ID: 39943650
How do I request attention ?
0
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 270 total points
ID: 39943653
there's a link under the original post
0
 

Author Comment

by:amucinobluedot
ID: 39943661
Thanks just did
0
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 152 total points
ID: 39944459
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
What Is Threat Intelligence?

Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

 

Author Comment

by:amucinobluedot
ID: 39950758
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
 

Author Comment

by:amucinobluedot
ID: 39950799
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
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 152 total points
ID: 39950853
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
 

Author Comment

by:amucinobluedot
ID: 39950869
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
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 152 total points
ID: 39950930
"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
 

Author Comment

by:amucinobluedot
ID: 39951180
I copy pasted it, that is what it reads.
0
 

Author Comment

by:amucinobluedot
ID: 39951199
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
 
LVL 52

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 152 total points
ID: 39951239
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
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 270 total points
ID: 39951273
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
 

Author Comment

by:amucinobluedot
ID: 39953159
Changing it didn't help. My windows date now shows :  49/d/yyyy
screenshot.gif
0
 
LVL 32

Assisted Solution

by:Big Monty
Big Monty earned 270 total points
ID: 39953208
Then I would backup your registry, then delete those registry keys
0
 

Author Comment

by:amucinobluedot
ID: 39953245
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
 

Author Comment

by:amucinobluedot
ID: 39953266
I added a couple more clocks, this is what is displayed after entering:  MM/dd/yyyy  in all the keys above.
0
 

Author Comment

by:amucinobluedot
ID: 39953270
screenshot
dates.gif
0
 
LVL 32

Accepted Solution

by:
Big Monty earned 270 total points
ID: 39953402
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
 
LVL 32

Expert Comment

by:Big Monty
ID: 39954089
just curious, are the dates displaying properly now?
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

I'm a big fan of Windows' offline folder caching and have used it on my laptops for over a decade.  One thing I don't like about it, however, is how difficult Microsoft has made it for the cache to be moved out of the Windows folder.  Here's how to …
OfficeMate Freezes on login or does not load after login credentials are input.
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now