| xHarbour Reference Documentation > Function Reference |
![]() |
![]() |
Extracts the numeric year from a Date value
Year( <dDate> ) --> nYear
The function returns a four digit year as a numeric value, or zero when <dDate> is an empty date.
Year() extracts the year from a date value as a four digit number, without recognizing the settings SET DATE or SET CENTURY. Other parts of a date value can be extracted using function Day() or Month().
| See also: | CDoW(), CMonth(), CtoD(), Day(), DtoC(), Hour(), Minute(), Month(), Secs() |
| Category: | Conversion functions , Date and time |
| Source: | rtl\dateshb.c |
| LIB: | xhb.lib |
| DLL: | xhbdll.dll |
// The example shows results of the function Year()
PROCEDURE Main
? Date() // result: 05/10/06
? Year( Date() ) // result: 2006
? Year( Date() ) - 19 // result: 1987
RETURN
http://www.xHarbour.com