PRB: Details on OLE Automation Date Conversion Routines (241370)



The information in this article applies to:

  • Microsoft Win32 Application Programming Interface (API)

This article was previously published under Q241370

SYMPTOMS

The IsDate function returns True when the expression is ambiguous. Examples of ambiguous expressions are:
  • 29 Feb 01
  • 30 Apr 01

CAUSE

When supplied with an expression, IsDate searches every possible date format to see if the expression can be represented as a date and then returns False only when all possibilities are used up.

For example, when you enter IsDate("29Feb01"), IsDate has no idea whether the specified value is in dd-mmm-yy or yy-mmm-dd format. IsDate returns True because "29Feb01" is a perfectly valid date in yy-mmm-dd format.

STATUS

This behavior is by design.

MORE INFORMATION

IsDate returns True if the expression is a date or if the expression can be converted to a valid date. Otherwise, IsDate returns False.

In Microsoft Windows, the range of valid dates is January 1, 100 A.D. through December 31, 9999 A.D. The ranges vary among operating systems.

A specified date can be represented in various formats like mm-dd-yy or dd-mmm-yy. As an example, the last day of 1999 can be written as:
  • 12/31/99 in the United States
  • 31/12/99 in Britain
  • 1999-12-31 (or 1999-Dec-31) using the International Standards Organization (ISO), or variant, format
You can interpret "29Feb01" in dd-mmm-yy as "01 Feb 2029" in dd-mmm-yyyy format.

The IsDate function tries to use your regional settings first. However, if that fails IsDate then tries other formats until all formats are used up. IsDate interprets "29Feb01" as a perfectly valid date, "Feb 01 2029" in mmm-dd-yyyy format. This is the official format in some countries and therefore, IsDate returns TRUE.

Modification Type:MajorLast Reviewed:8/5/2002
Keywords:kbDSupport kbprb KB241370