[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Win 8 dates displayed incorrectly (SQL 2008)

Posted on 2014-04-21
22
Medium Priority
?
265 Views
Last Modified: 2014-04-23
This is in my development computer. I have SQL 2008 R2 installed and I had win 7 with IIS installed.
My classic ASP application was running just fine. I have a script that formats the dates and it would display mm/dd/yyyy.
Then I upgraded to win 8, same code, same script, same database, only now the dates are displayed as dd/mm/yyyy

This is rather annoying because the ASP will validate all the dates to be mm/dd/yyyy so every time I hit 'update' I get an error.

Why is windows 8 doing this ?  My clock date is mm/dd/yyyy so that's not it.

Any ideas ?
0
Comment
Question by:amucinobluedot
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 13
  • 7
22 Comments
 

Author Comment

by:amucinobluedot
ID: 40013232
BTW ... this is constant, I have 3 computers, as soon as I upgraded them to win 8 ALL 3 have the same issue, so it is NOT the ASP code. If run under win 7 works fine.
0
 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 1752 total points
ID: 40013255
You need to set the LocalID.  Log into IIS, click on ASP and see the LocalID.  What is that set to?

http://support.microsoft.com/kb/229690
0
 

Author Comment

by:amucinobluedot
ID: 40013270
It reads '0'. What should I set it to ?
Attached how dates are displayed.
pageASP.gif
0
Understanding Web Applications

Without even knowing it, most of us are using web applications on a daily basis. Gmail and Yahoo email, Twitter, Facebook, and eBay are used by most of us daily—and they are web applications. We often confuse these web applications tools for websites.  So, what is the difference?

 

Author Comment

by:amucinobluedot
ID: 40013274
I set it to '1033' with the same result.
0
 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 1752 total points
ID: 40013319
What happens if you just use

<%
response.write now
response.write "<br>"
response.write formatdatetime(now,2)
%>
0
 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 1752 total points
ID: 40013331
Try this...

1) Go to your control panel

2) Click on Clock, Language and Region

3) Change Date, Time Format

I think that is where you can change to mm/dd/yyyy
0
 
LVL 16

Assisted Solution

by:joinaunion
joinaunion earned 248 total points
ID: 40013353
0
 

Author Comment

by:amucinobluedot
ID: 40013365
The script shows:

4/21/2014 4:19:13 PM
4/21/2014
0
 

Author Comment

by:amucinobluedot
ID: 40013366
Read that .. didn't fix anything
0
 

Author Comment

by:amucinobluedot
ID: 40013367
This is my script:

I display with:
<%= DoDateTime((Comments.Fields.Item("Lastupdate").Value), 2, 9225) %>  </p>

---

<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>					
function DoDateTime(str, nNamedFormat, nLCID)				
	dim strRet								
	dim nOldLCID								
										
	strRet = str								
	If (nLCID > -1) Then							
		oldLCID = Session.LCID						
	End If									
										
	On Error Resume Next							
										
	If (nLCID > -1) Then							
		Session.LCID = nLCID						
	End If									
										
   If ((nLCID < 0) Or (Session.LCID = nLCID)) Then                        
            strRet = FormatDateTime(str, nNamedFormat)                  
            strRet = Right("0" & Datepart("m",strRet),2) & "/" & Right("0" & Datepart("d",strRet),2) & "/" & DatePart("yyyy",strRet)
End If 									
										
	If (nLCID > -1) Then							
		Session.LCID = oldLCID						
	End If									
										
	DoDateTime = strRet							
End Function									
</SCRIPT>

Open in new window

0
 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 1752 total points
ID: 40013483
Try

<%= formatdatetime((Comments.Fields.Item("Lastupdate").Value), 2) %>

or

<%= DoDateTime((Comments.Fields.Item("Lastupdate").Value), 2, 1033) %>
0
 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 1752 total points
ID: 40013488
The problem is not in your windows machine or iis, it is with your script.   You are formatting to English(Caribbean)

See the link I gave you for reference
      strLCID = 9225  &apos; English(Caribbean)"?>
0
 

Author Comment

by:amucinobluedot
ID: 40013835
What should it read ?
0
 

Author Comment

by:amucinobluedot
ID: 40013837
I don't see any reference to that. This is the script:

<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>					
function DoDateTime(str, nNamedFormat, nLCID)				
	dim strRet								
	dim nOldLCID								
										
	strRet = str								
	If (nLCID > -1) Then							
		oldLCID = Session.LCID						
	End If									
										
	On Error Resume Next							
										
	If (nLCID > -1) Then							
		Session.LCID = nLCID						
	End If									
										
   If ((nLCID < 0) Or (Session.LCID = nLCID)) And IsDate(str) Then                       
            strRet = FormatDateTime(str, nNamedFormat)                  
            strRet = Right("0" & Datepart("m",strRet),2) & "/" & Right("0" & Datepart("d",strRet),2) & "/" & DatePart("yyyy",strRet)
End If 									
										
	If (nLCID > -1) Then							
		Session.LCID = oldLCID						
	End If									
										
	DoDateTime = strRet							
End Function									
</SCRIPT>

Open in new window

0
 

Author Comment

by:amucinobluedot
ID: 40013840
trying ...
0
 

Author Comment

by:amucinobluedot
ID: 40013845
Problem..

<%= DoDateTime((Alarms.Fields.Item("Schdemailon").Value), 2, 1033) %>

shows:   4/25/2014

Should be:  04/25/2014
0
 

Author Comment

by:amucinobluedot
ID: 40013850
Funny .. if I use this script instead it works fine, even with the 9225 ... how is that possible ?

<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>					
function DoDateTime(str, nNamedFormat, nLCID)				
	dim strRet								
	dim nOldLCID								
										
	strRet = str								
	If (nLCID > -1) Then							
		oldLCID = Session.LCID						
	End If									
										
	On Error Resume Next							
										
	If (nLCID > -1) Then							
		Session.LCID = nLCID						
	End If									
										
   If ((nLCID < 0) Or (Session.LCID = nLCID)) And IsDate(str) Then                       
            strRet = FormatDateTime(str, nNamedFormat)                  
            strRet = Right("0" & Datepart("m",strRet),2) & "/" & Right("0" & Datepart("d",strRet),2) & "/" & DatePart("yyyy",strRet)
End If 									
										
	If (nLCID > -1) Then							
		Session.LCID = oldLCID						
	End If									
										
	DoDateTime = strRet							
End Function									
</SCRIPT>

Open in new window

0
 

Author Comment

by:amucinobluedot
ID: 40013854
This one gives the weird date

---

<SCRIPT RUNAT=SERVER LANGUAGE=VBSCRIPT>					
function DoDateTime(str, nNamedFormat, nLCID)				
	dim strRet								
	dim nOldLCID								
										
	strRet = str								
	If (nLCID > -1) Then							
		oldLCID = Session.LCID						
	End If									
										
	On Error Resume Next							
										
	If (nLCID > -1) Then							
		Session.LCID = nLCID						
	End If									
										
	If ((nLCID < 0) Or (Session.LCID = nLCID)) Then				
		strRet = FormatDateTime(str, nNamedFormat)			
	End If									
										
	If (nLCID > -1) Then							
		Session.LCID = oldLCID						
	End If									
										
	DoDateTime = strRet							
End Function									
</SCRIPT>

Open in new window


---

Plus .. something also weird is that IT DOES WORK in win 7 and windows server, while on win 8 I get the date error ???

Makes no sense to me
0
 
LVL 54

Assisted Solution

by:Scott Fell, EE MVE
Scott Fell,  EE MVE earned 1752 total points
ID: 40013859
Your code here is supposed to be padding

Try and change
if ((nLCID < 0) Or (Session.LCID = nLCID)) Then                        
            strRet = FormatDateTime(str, nNamedFormat)                  
            strRet = Right("0" & Datepart("m",strRet),2) & "/" & Right("0" & Datepart("d",strRet),2) & "/" & DatePart("yyyy",strRet)
End If 

Open in new window

     
To
if ((nLCID < 0) Or (Session.LCID = nLCID)) Then                        
            strRet = FormatDateTime(str, 2)                  
            strRet = Right("0" & month(strRet)) & "/" & Right("0" & month(strRet)) & "/" & DatePart("yyyy",strRet)
End If 

Open in new window

0
 
LVL 54

Accepted Solution

by:
Scott Fell,  EE MVE earned 1752 total points
ID: 40013872
The function, DoDateTime is messing you up.  There is no need for that.  If you use my first suggestion you will be better off.

<%= formatdatetime((Comments.Fields.Item("Lastupdate").Value), 2) %>

Open in new window



Or for padding

<%

tempDate= formatdatetime((Comments.Fields.Item("Lastupdate").Value), 2) 
tempMonth=right("0"&month(tempDate)
tempDay=right("0"&day(tempDate)
newDate=tempMonth&"/"&tempDay&"/"&year(tempDate
response.write newDate
%>

 

Open in new window

0
 

Author Comment

by:amucinobluedot
ID: 40013889
Thanks
0

Featured Post

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!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Originally, this post was published on Monitis Blog, you can check it here . It goes without saying that technology has transformed society and the very nature of how we live, work, and communicate in ways that would’ve been incomprehensible 5 ye…
CTAs encourage people to do something specific to show interest in your company, product or service. Keep reading to learn why CTAs should always be thought of as extremely important, albeit small, sections of websites.
The viewer will learn how to dynamically set the form action using jQuery.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

649 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