YEAR( ) Function

Returns the year from the specified date or datetime expression.

YEAR(dExpression | tExpression)

Parameters

  • dExpression
    Specifies a date expression from which YEAR( ) returns the year. dExpression can be a function that returns a date, or a Date-type memory variable, array element, or field. It can also be a literal date string, such as {^1998-06-06}.
  • tExpression
    Specifies a datetime expression from which YEAR( ) returns the year.

Return Value

Numeric

Remarks

YEAR( ) always returns the year with the century. The CENTURY setting (ON or OFF) doesn't affect the returned value.

Example

CLEAR
? YEAR(DATE( ))

See Also

Reference

DATE( ) Function
DATETIME( ) Function
DOW( ) Function
SET CENTURY Command

Other Resources

Functions
Language Reference (Visual FoxPro)