Year Procedure
Returns the year component of a date.
Overload #1: Year(date)
Declaration
function Year(date as Date) as Number
Parameters
- date as Date — The time to extract the year component from.
Return value
Number — The year component of the date.
Example
Code
dim x = DateFromParts(2021, 3, 12)
print Year(x)
Output
Overload #2: Year(dateTime)
Declaration
function Year(dateTime as DateTime) as Number
Parameters
- dateTime as DateTime — The time to extract the year component from.
Return value
Number — The year component of the date.
Example
Code
dim x = DateTimeFromParts(2021, 3, 12, 14, 30, 59, 488)
print Year(x)
Output
Overload #3: Year(dateTimeOffset)
Declaration
function Year(dateTimeOffset as DateTimeOffset) as Number
Parameters
- dateTimeOffset as DateTimeOffset — The time to extract the year component from.
Return value
Number — The year component of the date.
Example
Code
dim x = DateTimeOffsetFromParts(2021, 3, 12, 4, 30, 59, 488, Years(-4))
print Year(x)
Output