Microsoft KB Archive/252734

= BUG: Date and Now Return Wrong Year in 16-Bit VBScript =

Article ID: 252734

Article Last Modified on 11/17/2003

-

APPLIES TO


 * Microsoft Visual Basic, Scripting Edition 3.0
 * Microsoft Visual Basic, Scripting Edition 4.0
 * Microsoft Visual Basic, Scripting Edition 5.0

-



This article was previously published under Q252734



SYMPTOMS
Visual Basic Script (VBScript) functions that calculate the current date might incorrectly calculate the year. For example, for January 24, 2000, the Date function returns 1/24/100 rather than 1/24/2000. The following functions are affected:
 * Date
 * Now

The bug does not affect the Time function because the date portion is masked off.



CAUSE
The 16-bit version of VBScript uses a call to localtime to get the current time. This call returns a struct tm, the tm_year member of which contains the current year minus 1900.



STATUS
Microsoft has confirmed that this is a bug in the Microsoft products that are listed at the beginning of this article.

Keywords: kbbug kbpending KB252734

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.