DATE( ) Function

Returns the current system date, which is controlled by the operating system, or creates a year 2000-compliant Date value.

DATE([nYear, nMonth, nDay])

Return Values

Date

Parameters

  • nYear
    Specifies the year returned in the year 2000-compliant Date value. nYear can be a value from 100 to 9999.
  • nMonth
    Specifies the month returned in the year 2000-compliant Date value. nMonth can be a value from 1 to 12.
  • nDay
    Specifies the day returned in the year 2000-compliant Date value. nDay can be a value from 1 to 31.

Remarks

DATE( ) returns the current system date if it is issued without the optional arguments. Include the optional arguments to return a year 2000-compliant Date value in the format set in the Regional tab of the Visual FoxPro Options dialog box. Any missing parameter is replaced with the current system value. For more information about creating year 2000-compliant Date values, see Year 2000 Date Support.

No Microsoft Visual FoxPro commands or functions can directly change the system date.

Example

The following example displays the current system date with and without the century, and then displays a year 2000-compliant date.

CLEAR
SET CENTURY OFF
? DATE( )  && Displays today's date without the century
SET CENTURY ON
? DATE( )  && Displays today's date with the century
? DATE(1998, 02, 16)  && Displays a year 2000-compliant Date value

See Also

CTOD( ) | DATETIME( ) | DTOC( ) | SET CENTURY | SET DATE | SET MARK TO | SYS( ) Functions Overview