Microsoft KB Archive/58791

= DATEVALUE# Function in Basic 7.00 Uses MM-DD-YY, Not DD-MM-YY =

Article ID: 58791

Article Last Modified on 11/21/2006



This article was previously published under Q58791



SUMMARY
The DATEVALUE# function that comes in the Date/Time Library of Microsoft Basic Professional Development System (PDS) Version 7.00 does not interpret dates in the form of &quot;dd/mm/yy&quot; or &quot;dd-mm-yy,&quot; where the day number precedes the month number (dd stands for day, mm stands for month, and yy stands for year). Instead, the DATEVALUE# function interprets dates in the form of &quot;mm/dd/yy&quot; or &quot;mm-dd-yy,&quot; where the month number precedes the day number. For example, you get &quot;Illegal Function Call&quot; (error 5) when passing &quot;30/12/88&quot; or &quot;30-12-88&quot; to the DATEVALUE# function.

Both Page 427 of the &quot;Microsoft Basic 7.0: Language Reference&quot; manual (for 7.00 and 7.10) and also the &quot;HELP: DateValue# Function Details&quot; screen in the Microsoft Advisor online Help system in QBX.EXE incorrectly state that &quot;30/12/88&quot; is one of the acceptable formats. This should be changed to say that &quot;12/30/88&quot; (&quot;mm/dd/yy&quot;) format is accepted by the DATEVALUE# function.

Also, the &quot;HELP: DateValue# Function Details&quot; screen in the Microsoft Advisor online Help system in QBX.EXE incorrectly states: &quot;To use DateValue# in the QBX environment, use the FINANCER.QLB Quick library.&quot; This should be changed to say the DTFMTER.QLB Quick library. (Page 427 of the reference manual correctly says to use DTFMTER.QLB in QBX.)

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
If you want to give the date before the month, you can use the name of the month instead of the numeric representation of the month.

The following are not accepted (&quot;Illegal Function Call&quot;): B# = DateValue# (&quot;30-12-88&quot;) B# = DateValue# (&quot;30/12/88&quot;) The following are accepted (the workaround is to use the spelled instead of the numeric month): B# = DateValue# (&quot;30-Dec-88&quot;) B# = DateValue# (&quot;30/Dec/88&quot;) The following are accepted (but month, day, and year must be in order): B# = DateValue# (&quot;12-30-88&quot;) B# = DateValue# (&quot;12/30/88&quot;) B# = DateValue# (&quot;December 30, 1988&quot;) DateValue# accepts dates between January 1, 1753, and December 31, 2078.

Complete Code Example
You can run this program with QBX /L DTFMTER.QLB, or link with the appropriate DTFMTxx.LIB file if making an .EXE program: REM $INCLUDE: 'DATIM.BI' d$ = &quot;30-Dec-88&quot; PRINT DateValue#(d$)  ' Prints 32507 d$ = &quot;12/30/88&quot; PRINT DateValue#(d$)  ' Prints 32507

Additional query words: BasicCom

Keywords: KB58791

-

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

© Microsoft Corporation. All rights reserved.