Share via


StrictDateEntry Property

Specifies whether date and DateTime values must be entered in a specific, strict format in a text box. Available at design time and run time.

Object.StrictDateEntry[ = nValue]

Return Value

  • nValue
    One of the following settings:

    Setting

    Description

    0   

    Loose. Dates and DateTime values can be entered in a loosely formatted manner. The order in which the days, months, and years are entered is determined by the DateFormat property or SET DATE.

    Spaces, backslashes, periods, hyphens, and the current date delimiter (specified with the DateMark property or SET MARK ) can be used to delimit date values. If the year is omitted from a date, the current year is used for the date.

    A caret (^) can be included as the first character in a date to specify year-month-day date ordering, overriding the order specified by the DateFormat property or SET DATE.

    A comma or a space can be used to delimit the date from the time in a DateTime value. When entering just an hour in a DateTime value, the colon can be omitted if the year is included in the date or a comma is used to separate the date from the time.

    If an invalid date or DateTime value is entered, an error message is not displayed and the text box value is set to an empty date or DateTime value. You can test for an invalid date in the Valid event.

    1   

    (Default) Strict. Provides compatibility with previous versions of Visual FoxPro.

    Dates in date and DateTime values must be entered in a strict 99/99/99 format when CENTURY is set to OFF, or a 99/99/9999 format when CENTURY is set to ON. 99 represents days, months, and years, and 9999 represents years including the century. The order in which the days, months, and years are entered is determined by the DateFormat property or SET DATE.

Remarks

Applies To: TextBox

The following table lists valid date and DateTime values you can enter in a text box when StrictDateEntry is set to 0 (Loose).

Date or DateTime value

Description

12 31

December 31st of the current year.

12 31 98 14

December 31st of 1998, 2 P.M.

12 31, 14

December 31st of the current year, 2 P.M.

12 - 31 - 98, 2p

December 31st of 1998, 2 P.M. Note the extra spaces between the hyphen delimiters.

^98-12-31, 2p

December 31st of 1998, 2 P.M. Caret (^) specifies year-month-day date ordering, overriding the order specified by the DateFormat property or SET DATE.

^/12/31

December 31st of the current year. Caret (^) specifies year-month-day date ordering, overriding the order specified by the DateFormat property or SET DATE.

See Also

Reference

Century Property

DateFormat Property

DateMark Property

Hours Property

Seconds Property

SET CENTURY Command

SET DATE Command

SET MARK TO Command

SET STRICTDATE Command

Other Resources

Properties (Visual FoxPro)

Language Reference (Visual FoxPro)