Microsoft KB Archive/57366

= DateSerial# Accepts Values Outside Range for Arguments =

Article ID: 57366

Article Last Modified on 10/20/2003

-

APPLIES TO


 * Microsoft BASIC Professional Development System 7.1
 * Microsoft BASIC Professional Development System 7.0

-



This article was previously published under Q57366



SUMMARY
Page 425 of the &quot;Microsoft Basic 7.0: Language Reference&quot; manual (for 7.00 and 7.10) states that the DateSerial# function will generate an &quot;Illegal function call&quot; if values are specified outside the given ranges of the following:

year% - A year from 1753 to 2078

month% - A month from 1 to 12

day% - A day from 1 to 31

An &quot;Illegal function call&quot; is only generated if the year, month, and day arguments generate a serial number outside the valid range of -53,688 to 65,380. The corresponding dates for this range are January 1, 1753, to December 31, 2078.

The README.DOC file provided with Microsoft Basic Professional Development System (PDS) Versions 7.00 and 7.10 notes this documentation error.

This information applies to Microsoft Basic Professional Development System (PDS) versions 7.00 and 7.10 for MS-DOS and MS OS/2.



MORE INFORMATION
The DateSerial# function can return serial numbers for dates in the following range, inclusive:

DATE: January 1, 1753, to December 31, 2078

SERIAL#: -53688 to 65380

The DateSerial# function generates an &quot;Illegal function call&quot; only if the arguments passed to it generate a serial number outside the range of -53,688 to 65,380. The following example uses a value outside the given range for the &quot;month%&quot; argument, but does not generate an &quot;Illegal function call&quot;: theDate# = DateSerial#(89, 13, 1) The serial number returned in the above call actually corresponds to the date January 1, 1990. A value of 13 logically corresponds to the month following December. Since December is the last month of a year, the year value is incremented by 1, and the month value is reset to 1, which corresponds to January; therefore, the following two calls to DateSerial# return the same serial number: theDate# = DateSerial#(89, 13, 1) theDate# = DateSerial#(90, 1, 1) Negative numbers work in the same way. A value of &quot;-1&quot; for the month argument refers to the month of November in the previous year. The following to calls to DateSerial# return the same serial number: theDate# = DateSerial#(90, -1, 1) theDate# = DateSerial#(89, 11, 1) The following are example calls to DateSerial# that generate the &quot;Illegal function call&quot; error message since the resulting serial number falls outside the valid range: theDate# = DateSerial#(2078, 12, 32) ->  January   1, 2079 theDate# = DateSerial#(2078, 13, 1)  ->  January   1, 2079 theDate# = DateSerial#(1753, 0, 31)  ->  December 31, 1752

Additional query words: BasicCom SR# S891227-47

Keywords: KB57366

-

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

© Microsoft Corporation. All rights reserved.