Share via


SET STRICTDATE Command

Specifies if ambiguous Date and DateTime constants generate errors.

SET STRICTDATE TO [0 | 1 | 2]

Parameters

  • 0
    Specifies that strict date format checking is off. This setting provides compatibility with earlier versions of Visual FoxPro. 0 is the default setting for the Visual FoxPro runtime and ODBC driver. When STRICTDATE is set to 0, invalid Date and DateTimes evaluate to the empty date.

  • 1
    Specifies that all Date and DateTime constants be in the strict date format. Any Date or DateTime constant that is not in the strict format or evaluates to an invalid value generates an error, either during compilation, at runtime, or during an interactive Visual FoxPro session. 1 is the default setting for an interactive Visual FoxPro session.

  • 2
    Identical to setting STRICTDATE to 1, but also generates a compilation error (2033 – CTOD and CTOT can produce incorrect results) whenever CTOD( ) and CTOT( ) functions appear in code.

    Because the values returned by CTOD( ) and CTOT( ) rely on SET DATE and SET CENTURY to interpret the date string they contain, they are prone to year 2000 noncompliance errors. Use DATE( ) and DATETIME( ) with the optional numeric arguments to create Date and DateTime constants and expressions.

    This setting is most useful during debugging sessions to trap for code that may contain year 2000 compliance errors.

Remarks

Note that the StrictDateEntry property isn't affected by the setting of SET STRICTDATE.

See Also

COMPILE | CTOD( ) | CTOT( ) | SET LOGERRORS | StrictDateEntry Property