PRB: DateValue Argument Gives "Illegal Function Call" Error

Last reviewed: June 21, 1995
Article ID: Q84547
The information in this article applies to:

- Standard and Professional Editions of Microsoft Visual Basic for

  Windows, versions 2.0 and 3.0
- Microsoft Visual Basic programming system for Windows, version 1.0

SYMPTOMS

You will correctly get an "Illegal function call" error for the DateValue argument if the short date (the three numbers representing the month, day, and year such as 4/24/92) does not follow the order of the date format selected under International settings in the Windows Control Panel.

STATUS

This behavior is by design.

MORE INFORMATION

The DateValue function returns a serial number that represents the date of the string argument. The string argument can be a date in abbreviated form (three numbers that represent the month, day, and year). However, this has to conform to the Short Date Format selected in the International settings of the Control Panel.

By default, the order is MDY or the month followed by the day and then the year separated by a slash (/) or a hyphen (-). An example of a valid argument is 4/24/92 for the date April 24, 1992. Using 24/4/92 would produce an "Illegal function call" error.

NOTE: For the long form of the date, DateValue recognizes April 24, 1992, Apr 24, 1992, 24-Apr-1992, and 24 April 92".

Remember that you will have to restart Windows for any changes made in the International settings to take effect.


Additional reference words: 1.00 2.00 3.00
KBCategory: kbprg kbprb
KBSubcategory: APrgOther


THE INFORMATION PROVIDED IN THE MICROSOFT KNOWLEDGE BASE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. MICROSOFT DISCLAIMS ALL WARRANTIES, EITHER EXPRESS OR IMPLIED, INCLUDING THE WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL MICROSOFT CORPORATION OR ITS SUPPLIERS BE LIABLE FOR ANY DAMAGES WHATSOEVER INCLUDING DIRECT, INDIRECT, INCIDENTAL, CONSEQUENTIAL, LOSS OF BUSINESS PROFITS OR SPECIAL DAMAGES, EVEN IF MICROSOFT CORPORATION OR ITS SUPPLIERS HAVE BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. SOME STATES DO NOT ALLOW THE EXCLUSION OR LIMITATION OF LIABILITY FOR CONSEQUENTIAL OR INCIDENTAL DAMAGES SO THE FOREGOING LIMITATION MAY NOT APPLY.

Last reviewed: June 21, 1995
© 1998 Microsoft Corporation. All rights reserved. Terms of Use.