Xbasic

CYEAR Function

Syntax

Year_String as C = CYEAR(D date)

Year_String as C = CYEAR( D time as T )

Arguments

date

A variable containing a date value or a character string containing a legitimate representation of a date value ( ISDATE (Date_Value) = .T.).

A variable containing a date time value.

Description

Converts a date to a character value of the form 'YYYY'.

Discussion

CYEAR() returns a character string (in the format "YYYY") containing the year specified in Date or Date_Time. You can combine the CYEAR() , CMONTH() , CDOW() , and DAY() functions to form custom date formats. For examples, see the DAY() function.

Example

cyear(START) -> "1995", if START contains 03/12/95
cyear( ctod( "05/19/94") ) -> "1994"

See Also