VBScript Date format- regional settings ? 
Author Message
 VBScript Date format- regional settings ?

I'm running some VBScript with ASP which works with dates and an access
database.

When I use the code:
dteYear = Year(#23/09/01#)

The year is returned as 2023, not 2001 as I expected.

I thought that VBScript used the local settings for determining local
settings for time?  The code is running on my PWS and regional settings
for the PC are UK(GMT).

Anyone got any ideas what is going on, ultimately the data is to be
pulled from a input box which would be in dd/mm/yy format and I don't
which to write further code to manipulate it before passing it to the
year.

Thanks,

Scott.

Sent via Deja.com
http://www.*-*-*.com/



Sun, 22 Jun 2003 00:17:05 GMT  
 VBScript Date format- regional settings ?
Just to be doubly sure -- are the date tab settings (w/in the regional
settings control panel item) consistent with the English(UK) regional
settings? IOW, is the short date format expressly noted as dd/mm/yy? (It's
possible to set different detailed date settings and still see the
"English(UK)" regional setting in the primary tab.)
Quote:

> I'm running some VBscript with ASP which works with dates and an access
> database.

> When I use the code:
> dteYear = Year(#23/09/01#)

> The year is returned as 2023, not 2001 as I expected.

> I thought that VBScript used the local settings for determining local
> settings for time?  The code is running on my PWS and regional settings
> for the PC are UK(GMT).

> Anyone got any ideas what is going on, ultimately the data is to be
> pulled from a input box which would be in dd/mm/yy format and I don't
> which to write further code to manipulate it before passing it to the
> year.

> Thanks,

> Scott.

> Sent via Deja.com
> http://www.deja.com/



Sun, 22 Jun 2003 05:10:15 GMT  
 VBScript Date format- regional settings ?
Try setting locale explicitly for the duration of the ASP script execution
with the VBScript SetLocale function...

Q264063 - VBScript Date and Time Functions May not be Formatted Properly in
Non-English (US) Locales
http://support.microsoft.com/support/kb/articles/Q264/0/63.ASP

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> I'm running some VBscript with ASP which works with dates and an access
> database.

> When I use the code:
> dteYear = Year(#23/09/01#)

> The year is returned as 2023, not 2001 as I expected.

> I thought that VBScript used the local settings for determining local
> settings for time?  The code is running on my PWS and regional settings
> for the PC are UK(GMT).

> Anyone got any ideas what is going on, ultimately the data is to be
> pulled from a input box which would be in dd/mm/yy format and I don't
> which to write further code to manipulate it before passing it to the
> year.

> Thanks,

> Scott.

> Sent via Deja.com
> http://www.deja.com/



Sun, 22 Jun 2003 10:53:22 GMT  
 VBScript Date format- regional settings ?
Yes the tab settings do explicitly say dd/mm/yy for short date format.



Quote:
> Just to be doubly sure -- are the date tab settings (w/in the regional
> settings control panel item) consistent with the English(UK) regional
> settings? IOW, is the short date format expressly noted as dd/mm/yy?
(It's
> possible to set different detailed date settings and still see the
> "English(UK)" regional setting in the primary tab.)




Quote:
> > I'm running some VBscript with ASP which works with dates and an
access
> > database.

> > When I use the code:
> > dteYear = Year(#23/09/01#)

> > The year is returned as 2023, not 2001 as I expected.

> > I thought that VBScript used the local settings for determining
local
> > settings for time?  The code is running on my PWS and regional
settings
> > for the PC are UK(GMT).

> > Anyone got any ideas what is going on, ultimately the data is to be
> > pulled from a input box which would be in dd/mm/yy format and I
don't
> > which to write further code to manipulate it before passing it to
the
> > year.

> > Thanks,

> > Scott.

> > Sent via Deja.com
> > http://www.deja.com/

Sent via Deja.com
http://www.deja.com/


Sun, 22 Jun 2003 16:51:03 GMT  
 VBScript Date format- regional settings ?
Thanks.

Following your advice it appears that the lcid setting was 1033
(English-US) and using SetLocale to set to UK appears to work, but the
VBScript help file does suggest that local settings should be
prevalent.  Do you know if this is then a recognised bug, or is their
alternative solutions.



Quote:
> Try setting locale explicitly for the duration of the ASP script
execution
> with the VBScript SetLocale function...

> Q264063 - VBScript Date and Time Functions May not be Formatted
Properly in
> Non-English (US) Locales
> http://support.microsoft.com/support/kb/articles/Q264/0/63.ASP

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

> Please do not email questions - post them to the newsgroup instead.
> --




- Show quoted text -

Quote:
> > I'm running some VBscript with ASP which works with dates and an
access
> > database.

> > When I use the code:
> > dteYear = Year(#23/09/01#)

> > The year is returned as 2023, not 2001 as I expected.

> > I thought that VBScript used the local settings for determining
local
> > settings for time?  The code is running on my PWS and regional
settings
> > for the PC are UK(GMT).

> > Anyone got any ideas what is going on, ultimately the data is to be
> > pulled from a input box which would be in dd/mm/yy format and I
don't
> > which to write further code to manipulate it before passing it to
the
> > year.

> > Thanks,

> > Scott.

> > Sent via Deja.com
> > http://www.deja.com/

Sent via Deja.com
http://www.deja.com/


Sun, 22 Jun 2003 17:05:46 GMT  
 VBScript Date format- regional settings ?
Regional settings are per user...

An ASP running under the IUSR/IWAM_machinename account is not a typical
"user".  In that context, the regional settings are taken from

HKEY_USERS\.DEFAULT\Control Panel\International

A real user actually logged on to the server as an interactive user gets
regional settings from

HKEY_CURRENT_USER\Control Panel\International

which is unique to that user and can be changed independently from any other
user.  The first time a real user logs on the HKCU branch gets its initial
values from

HKEY_USERS\.DEFAULT\Control Panel\International

just like IUSR/IWAM_machinename with the difference being that a real user's
regional settings changes are persistent after they log off.

So the bottom line is, customized the HKEY_USERS\.DEFAULT\Control
Panel\International branch in the registry and that's what an ASP page will
use...

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> Yes the tab settings do explicitly say dd/mm/yy for short date format.



> > Just to be doubly sure -- are the date tab settings (w/in the regional
> > settings control panel item) consistent with the English(UK) regional
> > settings? IOW, is the short date format expressly noted as dd/mm/yy?
> (It's
> > possible to set different detailed date settings and still see the
> > "English(UK)" regional setting in the primary tab.)



> > > I'm running some VBscript with ASP which works with dates and an
> access
> > > database.

> > > When I use the code:
> > > dteYear = Year(#23/09/01#)

> > > The year is returned as 2023, not 2001 as I expected.

> > > I thought that VBScript used the local settings for determining
> local
> > > settings for time?  The code is running on my PWS and regional
> settings
> > > for the PC are UK(GMT).

> > > Anyone got any ideas what is going on, ultimately the data is to be
> > > pulled from a input box which would be in dd/mm/yy format and I
> don't
> > > which to write further code to manipulate it before passing it to
> the
> > > year.

> > > Thanks,

> > > Scott.

> > > Sent via Deja.com
> > > http://www.deja.com/

> Sent via Deja.com
> http://www.deja.com/



Mon, 23 Jun 2003 11:31:10 GMT  
 VBScript Date format- regional settings ?

see my other reply re:

HKEY_USERS\.DEFAULT\Control Panel\International

--
Michael Harris
Microsoft.MVP.Scripting
--

Please do not email questions - post them to the newsgroup instead.
--

Quote:

> Thanks.

> Following your advice it appears that the lcid setting was 1033
> (English-US) and using SetLocale to set to UK appears to work, but the
> VBScript help file does suggest that local settings should be
> prevalent.  Do you know if this is then a recognised bug, or is their
> alternative solutions.



> > Try setting locale explicitly for the duration of the ASP script
> execution
> > with the VBScript SetLocale function...

> > Q264063 - VBScript Date and Time Functions May not be Formatted
> Properly in
> > Non-English (US) Locales
> > http://support.microsoft.com/support/kb/articles/Q264/0/63.ASP

> > --
> > Michael Harris
> > Microsoft.MVP.Scripting
> > --

> > Please do not email questions - post them to the newsgroup instead.
> > --



> > > I'm running some VBscript with ASP which works with dates and an
> access
> > > database.

> > > When I use the code:
> > > dteYear = Year(#23/09/01#)

> > > The year is returned as 2023, not 2001 as I expected.

> > > I thought that VBScript used the local settings for determining
> local
> > > settings for time?  The code is running on my PWS and regional
> settings
> > > for the PC are UK(GMT).

> > > Anyone got any ideas what is going on, ultimately the data is to be
> > > pulled from a input box which would be in dd/mm/yy format and I
> don't
> > > which to write further code to manipulate it before passing it to
> the
> > > year.

> > > Thanks,

> > > Scott.

> > > Sent via Deja.com
> > > http://www.deja.com/

> Sent via Deja.com
> http://www.deja.com/



Mon, 23 Jun 2003 11:32:23 GMT  
 VBScript Date format- regional settings ?
Thump!  Thump!  Thump!
(Me bashing head against head for being so thick.)

Oh joy. Oh bliss. Oh koo kalay.

What a winner.

And other assorted superlatives :)))))))))))))))

Aren't the answers to the most frustrating problems always so {*filter*}y simple!
GGGGGGrrrrrrrrr.

I have been trying to find the answer to that one for ever since Option Pack
For NT4 (IIS4) came out in 1997. I suppose that I had become so {*filter*}y
obsessed and frustrated with it that I couldn't see the wood for the trees.

All the users that have specific profiles in HKEY_USERS\ also have profiles
on disk and IUSR/IWAM don't so where else would they get their settings
from.

And I shudder to think about the amount of code that got written to
circumvent the probelm while cursing the '{*filter*}y yanks' for having such a
'{*filter*}y stupid' date format.

By the way Michael, are you single?


Quote:
> Regional settings are per user...

> An ASP running under the IUSR/IWAM_machinename account is not a typical
> "user".  In that context, the regional settings are taken from

> HKEY_USERS\.DEFAULT\Control Panel\International

> A real user actually logged on to the server as an interactive user gets
> regional settings from

> HKEY_CURRENT_USER\Control Panel\International

> which is unique to that user and can be changed independently from any
other
> user.  The first time a real user logs on the HKCU branch gets its initial
> values from

> HKEY_USERS\.DEFAULT\Control Panel\International

> just like IUSR/IWAM_machinename with the difference being that a real
user's
> regional settings changes are persistent after they log off.

> So the bottom line is, customized the HKEY_USERS\.DEFAULT\Control
> Panel\International branch in the registry and that's what an ASP page
will
> use...

> --
> Michael Harris
> Microsoft.MVP.Scripting
> --

> Please do not email questions - post them to the newsgroup instead.
> --


> > Yes the tab settings do explicitly say dd/mm/yy for short date format.



> > > Just to be doubly sure -- are the date tab settings (w/in the regional
> > > settings control panel item) consistent with the English(UK) regional
> > > settings? IOW, is the short date format expressly noted as dd/mm/yy?
> > (It's
> > > possible to set different detailed date settings and still see the
> > > "English(UK)" regional setting in the primary tab.)



> > > > I'm running some VBscript with ASP which works with dates and an
> > access
> > > > database.

> > > > When I use the code:
> > > > dteYear = Year(#23/09/01#)

> > > > The year is returned as 2023, not 2001 as I expected.

> > > > I thought that VBScript used the local settings for determining
> > local
> > > > settings for time?  The code is running on my PWS and regional
> > settings
> > > > for the PC are UK(GMT).

> > > > Anyone got any ideas what is going on, ultimately the data is to be
> > > > pulled from a input box which would be in dd/mm/yy format and I
> > don't
> > > > which to write further code to manipulate it before passing it to
> > the
> > > > year.

> > > > Thanks,

> > > > Scott.

> > > > Sent via Deja.com
> > > > http://www.*-*-*.com/

> > Sent via Deja.com
> > http://www.*-*-*.com/



Mon, 23 Jun 2003 13:14:16 GMT  
 
 [ 8 post ] 

 Relevant Pages 

1. Date format vbLongDate ignores server's regional settings

2. Date format and regional settings

3. How Can I Change the Short Date Format At Regional Settings in Control Panel

4. reliable date formatting unrelated to regional settings

5. IIS regional settings- incorrect VBscript date()

6. How do I display dates in regional format

7. Displaying dates in regional format

8. Setting the Regional Date and Time Settings.

9. Dates, MaskedBox, Regional settings and short date

10. Dates, MaskedBox, Regional settings and short date

11. Number format and regional settings

12. Regional Settings problem with Val(), Format$(), etc...

 

 
Powered by phpBB® Forum Software