SunQuest
           ASP Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreASP Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old February 24th, 2003, 07:28 PM
ngibsonau ngibsonau is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 138 ngibsonau User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Angry does the ASP VBscript setLocale function work?

I am a little confused about what the VBScript setLocale function does in ASP.

I'm changing the locale from 1033 (US english) to 3081 (Aust English) which should change the date format from mm/dd/yyyy to dd/mm/yyyy

Session.LCID changes what is returned from getLocale as does setLocale. But only the session.LCID actually change what the date output looks like!

Here is some code:
Code:
<html>
<head>
  <title></title>
</head>
<body>
getLocale(): <%= getLocale() %><br>
now() <%= now() %><br>
setLocale(1033): <%= setLocale(1033) %><br>
getLocale(): <%= getLocale() %><br>
now() <%= now() %><br>
setLocale(3081): <%= setLocale(3081) %><br>
getLocale(): <%= getLocale() %><br>
now() <%= now() %><br>
</body>
</html>


getLocale(): 3081
now() 25/02/2003 12:10:02 PM
setLocale(1033): 3081
getLocale(): 1033
now() 25/02/2003 12:10:02 PM
setLocale(3081): 1033
getLocale(): 3081
now() 25/02/2003 12:10:02 PM


Here is the work around and output that I would expect from the above!
Code:
<html>
<head>
  <title></title>
</head>
<body>
getLocale(): <%= getLocale() %><br>
now() <%= now() %><br>
Session.LCID = 1033: <% Session.LCID = 1033 %><br>
getLocale(): <%= getLocale() %><br>
now() <%= now() %><br>
Session.LCID = 3081: <% Session.LCID = 3081 %><br>
getLocale(): <%= getLocale() %><br>
now() <%= now() %><br>
</body>
</html>


getLocale(): 3081
now() 25/02/2003 12:11:10 PM
Session.LCID = 1033:
getLocale(): 1033
now() 2/25/2003 12:11:10 PM
Session.LCID = 3081:
getLocale(): 3081
now() 25/02/2003 12:11:10 PM

Can anybody verify my results or explain why this happens?
I'm using IIS5 on Windows2000. My Os locale is 3081
__________________
--

ngibsonau

Reply With Quote
  #2  
Old March 5th, 2003, 07:00 AM
ngibsonau ngibsonau is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 138 ngibsonau User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Am I confusing everone?

Here is my question in English.

If in ASP using the VBScript function setLocale function and the the getlocale function, the locale returned from the getlocale function is what you set it to with the setlocale function.

ie.
Code:
setlocale(3081)
response.write getLocale


will return 3081

But if your system locale is 1033 (US english) and you do a response.write Now() the date will be returned in the format mm/dd/yyyy. This is not correct not for the locale 3081 (Aust English) which we set it too, it should appear as dd/mm/yyyy

But if I use Session.LCID = 3081
and response.write now the date will appear in the format dd/mm/yyyy
and getLocale will also return 3081, the same return value as for when we called the setlocale function and then getLocale.

Why doesn't setLocale change the output of the now function and why does it appear to do nothing to the locale except make you think it has changed when it hasn't!

Is this a Bug in IIS5?

Reply With Quote
  #3  
Old March 6th, 2003, 04:46 PM
Utopia's Avatar
Utopia Utopia is offline
superficial
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2002
Location: Peterborough, England
Posts: 188 Utopia User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 36 m 8 sec
Reputation Power: 7
1.) Do you have the default system locale set to what you want, within the web servers regional settings

2.) Try <%@Language="VBScript" LCID="xxxx"%>

It's rather crap, as you've found out. I found on an NT web server that I had check the box in the regional settings to make the locale the default in order to make it work how I wanted.......
__________________
_______________
Matt

Reply With Quote
  #4  
Old March 6th, 2003, 08:20 PM
ngibsonau ngibsonau is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2003
Posts: 138 ngibsonau User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
yeah I know LCID works.

where abouts do you set the regional settings for the IIS.

can you walk me through the dialogs.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreASP Programming > does the ASP VBscript setLocale function work?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway