Partager via


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 Value

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 Options dialog box. Any NULL parameter is replaced with the current system value.

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

Reference

CTOD( ) Function

DATETIME( ) Function

DTOC( ) Function

SET CENTURY Command

SET DATE Command

SET MARK TO Command

SYS( ) Functions Overview

Other Resources

Functions

Language Reference (Visual FoxPro)