Year Function | |
Extract the number of the year from a date.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION Year(
dDate AS DATE
) AS DWORD
public static uint Year(
Date dDate
)
Request Example
View SourceParameters
- dDate
- Type: Date
The date.
Return Value
Type:
DWord
The year of
dDate, including the century digits, as a 4-digit number.
The value returned is not affected by SetDateFormat(), SetCentury(), SET DATE, or SET CENTURY. Specifying a NULL_DATE returns 0.
Remarks
Year() is a date conversion function that converts a date value to a numeric year value.
If the century digits are not specified, the century is determined by the rules of SET EPOCH or SetEpoch().
Year() is a member of a group of functions that return components of a date value as numbers.
The group includes Day() and Month(), which return the day and month values as numbers.
Examples
These examples illustrate Year() using the system date:
1? TODAY()
2? YEAR(TODAY())
3? YEAR(TODAY()) + 11
4? YEAR(05.15.64)
5SetEpoch(2000)
6? YEAR(CTOD("05.15.64"))
This example creates a function using Year() to format a date value in the form month, day, year:
1? Mdy(TODAY())
2FUNCTION Mdy(dDate)
3 RETURN CMONTH(dDate) + " " + ;
4 NTrim(DAY(dDate)) ;
5 + "," + STR(YEAR(dDate))
See Also