Hi folks

I've recently updated my XP laptop to SP3 which has uplifted WSH to v5.7 and
this has introduced a bug regarding the Date () function. When the result is
being converted to a string, it doesn't use the correct local format, but
seems to default to US format instead. Here in the UK the standard format is
DD/MM/YYYY. Here is some example code:

WScript.Echo Date ()
WScript.Echo â??â?? & Date ()
WScript.Echo CStr (Date ())

Under 5.6 this produces the correct output:

Microsoft (R) Windows Script Host Version 5.6
Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.

04/07/2008
04/07/2008
04/07/2008

Under WSH 5.7 the output is:

Microsoft (R) Windows Script Host Version 5.7
Copyright (C) Microsoft Corporation. All rights reserved.

04/07/2008
7/4/2008
7/4/2008

This happens in both cscript.exe and wscript.exe.

Is this a known bug? The main problem I have with it is that any WMI queries
using the date either fail or return the wrong data.

Regards
Tony Longson.

Re: Known bug in CStr (Date ()) in WSH 5.7? by Alexander

Alexander
Fri Jul 11 13:55:41 CDT 2008

Tony Longson schrieb:
>
> I've recently updated my XP laptop to SP3 which has uplifted WSH to v5.7 and
> this has introduced a bug regarding the Date () function
> .... Here in the UK the standard format is
> DD/MM/YYYY. Here is some example code:
>
> WScript.Echo Date ()
> WScript.Echo â??â?? & Date ()
> WScript.Echo CStr (Date ())
>
> Under 5.6 this produces the correct output:

> 04/07/2008
> 04/07/2008
> 04/07/2008
>
> Under WSH 5.7 the output is:
>
>
> 04/07/2008
> 7/4/2008
> 7/4/2008

This reply won't probably help you but here on XP SP3 WSH 5.7 with
german locale settings with DD.MM.YYYY as standard short date format

the output is as expected:

11.07.2008
11.07.2008
11.07.2008


It might help to test WSH 5.7 on some other machines with UK locale
to see if it is WSH 5.7, that fails or some system DLL or whatever.


> This happens in both cscript.exe and wscript.exe.
>
> Is this a known bug? The main problem I have with it is that any WMI queries
> using the date either fail or return the wrong data.

Actually you should never rely on an automated date to string
conversion. It's much safer to use date functions such as Day, Month,
DatePart, FormatDatetime etc to build a date string properly formatted.

MfG,
Alex

Re: Known bug in CStr (Date ()) in WSH 5.7? by Dr

Dr
Fri Jul 11 15:41:04 CDT 2008

In microsoft.public.scripting.vbscript message <5CB5D3A1-78EA-4EC9-A6DD-
C1D4EC1C1654@microsoft.com>, Fri, 11 Jul 2008 08:49:00, Tony Longson
<Tony@Longson.?.microsoft.com.invalid> posted:
>
>I've recently updated my XP laptop to SP3 which has uplifted WSH to v5.7 and
>this has introduced a bug regarding the Date () function.

I've not seen your problem; but my OS is set to YYYY-MM-DD.

WSH 5.7 does NOT fix the ISO Week Number bug seen in WSH 5.1 and 5.6;
details are in <URL:http://www.merlyn.demon.co.uk/vb-date2.htm#Week>,
with better code. Any comment you may have on those VBS pages would be
welcome.

My general recommendation is never to use conversion code of US origin
for converting to or from strings in non-US format; they are not
trustworthy - as you will recall from their general attitude towards tea
and cricket. Use DateSerial and TimeSerial to generate CDates; the
extra time taken in coding substringing will be repaid (though you won't
recognise it) on the first occasion on which trusting system conversion
would have failed.

In general, use locality-independent primitives in a locality-dependent
manner, unless you MUST respond to OS settings.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm moredate.htm js-dates.htm pas-time.htm critdate.htm etc.

Re: Known bug in CStr (Date ()) in WSH 5.7? by Dr

Dr
Sat Jul 12 05:27:46 CDT 2008

On Jul 11, 4:49=A0pm, Tony Longson <Tony
Long...@discussions.microsoft.com> wrote:
> Hi folks
>
> I've recently updated my XP laptop to SP3 which has uplifted WSH to v5.7 =
and
> this has introduced a bug regarding the Date () function. When the result=
is
> being converted to a string, it doesn't use the correct local format, but
> seems to default to US format instead. Here in the UK the standard format=
is
> DD/MM/YYYY.

NOT confirmed by test here. I get what I ought to get (with VBscript
5.7 in a local Web page). Nevertheless, my previous comment still
applies.

--
(c) John Stockton, near London, UK. Posting with Google.
Mail: J.R.""""""""@physics.org or (better) via Home Page at
Web: <URL:http://www.merlyn.demon.co.uk/>
FAQish topics, acronyms, links, etc.; Date, Delphi, JavaScript, ...




Re: Known bug in CStr (Date ()) in WSH 5.7? by Steve

Steve
Sat Jul 12 06:20:41 CDT 2008

Tony Longson wrote:
> Hi folks
>
> I've recently updated my XP laptop to SP3 which has uplifted WSH to
> v5.7 and this has introduced a bug regarding the Date () function.
> When the result is being converted to a string, it doesn't use the
> correct local format, but seems to default to US format instead. Here
> in the UK the standard format is DD/MM/YYYY.

Script output is not displayed as expected when you run VBScript or
JScript scripts in Windows Vista Service Pack 1, in Windows Server 2008,
or in Windows XP Service Pack 3:
http://support.microsoft.com/?kbid=951978

Update for Windows XP (KB951978):
http://www.microsoft.com/downloads/details.aspx?FamilyID=705e21de-f7dc-4d19-aafc-f22d3fca772f&DisplayLang=en

Update for Windows Vista (KB951978):
http://www.microsoft.com/downloads/details.aspx?FamilyID=84c6b8d8-4628-4e9a-8c9a-48c6fba83569&displaylang=en

--
Steve

A great many people mistake opinions for thoughts. -Herbert V. Prochnow



Re: Known bug in CStr (Date ()) in WSH 5.7? by Dr

Dr
Sat Jul 12 07:14:08 CDT 2008

In microsoft.public.scripting.vbscript message <4877acad$0$7539$9b4e6d93
@newsspool1.arcor-online.net>, Fri, 11 Jul 2008 20:55:41, Alexander
Mueller <millerax@hotmail.com> posted:

>Actually you should never rely on an automated date to string
>conversion. It's much safer to use date functions such as Day, Month,
>DatePart, FormatDatetime etc to build a date string properly formatted.

DatePart is not entirely reliable; see
<URL:http://www.merlyn.demon.co.uk/vb-date2.htm#WN>

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (SonOfRFC1036)
Do not Mail News to me. Before a reply, quote with ">" or "> " (SonOfRFC1036)

RE: Known bug in CStr (Date ()) in WSH 5.7? by TonyLongson

TonyLongson
Tue Jul 15 05:09:00 CDT 2008

Thanks for your comments folks.

The issue has now been resolved by hotfix KB951978.

Tony

"Tony Longson" wrote:

> Hi folks
>
> I've recently updated my XP laptop to SP3 which has uplifted WSH to v5.7 and
> this has introduced a bug regarding the Date () function. When the result is
> being converted to a string, it doesn't use the correct local format, but
> seems to default to US format instead. Here in the UK the standard format is
> DD/MM/YYYY. Here is some example code:
>
> WScript.Echo Date ()
> WScript.Echo â??â?? & Date ()
> WScript.Echo CStr (Date ())
>
> Under 5.6 this produces the correct output:
>
> Microsoft (R) Windows Script Host Version 5.6
> Copyright (C) Microsoft Corporation 1996-2001. All rights reserved.
>
> 04/07/2008
> 04/07/2008
> 04/07/2008
>
> Under WSH 5.7 the output is:
>
> Microsoft (R) Windows Script Host Version 5.7
> Copyright (C) Microsoft Corporation. All rights reserved.
>
> 04/07/2008
> 7/4/2008
> 7/4/2008
>
> This happens in both cscript.exe and wscript.exe.
>
> Is this a known bug? The main problem I have with it is that any WMI queries
> using the date either fail or return the wrong data.
>
> Regards
> Tony Longson.
>

Re: Known bug in CStr (Date ()) in WSH 5.7? by Alex

Alex
Tue Jul 15 14:07:57 CDT 2008

"Dr J R Stockton" <jrs@merlyn.demon.co.uk> wrote in message
news:xODJBsRgV8dIFwUM@invalid.uk.co.demon.merlyn.invalid...
> In microsoft.public.scripting.vbscript message <5CB5D3A1-78EA-4EC9-A6DD-

> My general recommendation is never to use conversion code of US origin
> for converting to or from strings in non-US format; they are not
> trustworthy - as you will recall from their general attitude towards tea
> and cricket.

Oh, come now. We're always up for a good tea party. :p



Re: Known bug in CStr (Date ()) in WSH 5.7? by Al

Al
Tue Jul 15 21:16:44 CDT 2008


"Dr J R Stockton" <jrs@merlyn.demon.co.uk> wrote in message
news:xODJBsRgV8dIFwUM@invalid.uk.co.demon.merlyn.invalid...
> In microsoft.public.scripting.vbscript message <5CB5D3A1-78EA-4EC9-A6DD-

> My general recommendation is never to use conversion code of US origin
> for converting to or from strings in non-US format; they are not
> trustworthy - as you will recall from their general attitude towards tea
> and cricket.

LOL. To say nothing of them calling the american game "football" when the
ball itself is more often handled than kicked.

The story is that their English ain't so good either. But in your sentence
above you seem to have changed the subject from "conversion code of US
origin" before the semicolon to the US originators of said code after the
" - ", leaving the intended target of the intervening "they" to be just a
guess between the two.

I forget what that particular grammatical error is called; but I'll bet you
remember! ;-)

/Al



Re: Known bug in CStr (Date ()) in WSH 5.7? by Al

Al
Tue Jul 15 21:08:40 CDT 2008


"Alex K. Angelopoulos" <aka(at)mvps.org> wrote in message
news:eEKFh4q5IHA.1592@TK2MSFTNGP04.phx.gbl...
> "Dr J R Stockton" <jrs@merlyn.demon.co.uk> wrote in message
> news:xODJBsRgV8dIFwUM@invalid.uk.co.demon.merlyn.invalid...
>> In microsoft.public.scripting.vbscript message <5CB5D3A1-78EA-4EC9-A6DD-
>
>> My general recommendation is never to use conversion code of US origin
>> for converting to or from strings in non-US format; they are not
>> trustworthy - as you will recall from their general attitude towards tea
>> and cricket.
>
> Oh, come now. We're always up for a good tea party. :p

ROTFLMAO!

/Al



Re: Known bug in CStr (Date ()) in WSH 5.7? by Bob

Bob
Wed Jul 16 06:19:33 CDT 2008

Al Dunbar wrote:
> "Dr J R Stockton" <jrs@merlyn.demon.co.uk> wrote in message
> news:xODJBsRgV8dIFwUM@invalid.uk.co.demon.merlyn.invalid...
>> In microsoft.public.scripting.vbscript message
>> <5CB5D3A1-78EA-4EC9-A6DD-
>
>> My general recommendation is never to use conversion code of US
>> origin for converting to or from strings in non-US format; they are
>> not trustworthy - as you will recall from their general attitude
>> towards tea and cricket.
>
> LOL. To say nothing of them calling the american game "football" when
> the ball itself is more often handled than kicked.
>
> The story is that their English ain't so good either. But in your
> sentence above you seem to have changed the subject from "conversion
> code of US origin" before the semicolon to the US originators of said
> code after the " - ", leaving the intended target of the intervening
> "they" to be just a guess between the two.
>
> I forget what that particular grammatical error is called; but I'll
> bet you remember! ;-)

> Something about "parallel construction" IIRC :-)

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"