getYear()
Table of Contents
Overview
The getYear() function takes a dateTimeValue as an argument, and returns the year value from it.
Return Type
- Number
 
Syntax
<variable> = <dateTimeValue>.getYear();
(OR)
<variable> = getYear( <dateTimeValue> );
(OR)
<variable> = <dateTimeValue>.year();
(OR)
<variable> = year( <dateTimeValue> );
| Parameter | Description | Data type | 
|---|---|---|
| <variable> | Variable which will contain the returned number. | NUMBER | 
| <dateTimeValue> | The date-time value from which the year value will be returned. The time value is not taken into account while using this function. A runtime error will be encountered if: 
 The function returns a null value if: 
 Refer this help document to learn about the supported date-time formats.  | DATE-TIME | 
Examples
currentDate = '01-Jan-2019';
year = currentDate.getYear(); // returns 2019
year = currentDate.getYear(); // returns 2019