The function YEAR converts a date or time period to a year in number format.
This function is useful if you want to easily compare years to see if they're the same.
Syntax
YEAR(Value to convert, [Time period method])
Arguments
| Argument | Data type | Description |
| Value to convert | Date, Time period | The date or time period to convert to a year, as a number. |
| Time period method (optional) | Keyword | Determines whether to extract the year from the start, middle, or end of a time period. |
The keywords for the time period method argument are:
- START, the default method, returns the year for the first date in the time period
- MID, which returns the year for the date in the middle of the time period
- END, which returns the year for the last date in the time period
The YEAR function returns a number.
Excel equivalent
Examples
Convert a Date to a Number data type
In this example, the line item Date is in Date format. The line item Number returns the Number format of the year using the formula YEAR(Date).
| Jan 25 | Feb 25 | Mar 25 | Apr 25 | May 25 | |
| Date | 01/01/2025 | 02/02/2025 | 03/03/2025 | 04/04/2025 | 05/05/2025 |
NumberYEAR(Date) | 2,025 | 2,025 | 2,025 | 2,025 | 2,025 |
Convert a Time-formatted list item to a Number data type
In this example, the target module is dimensioned by a list with a property called Months. This is the List as viewed in Grid View.
| Parent | Code | Months | |
| 1 | Dec 21 | ||
| 2 | Jan 21 | ||
| 3 | Sep 22 | ||
| 4 | Jul 24 | ||
| 5 | Dec 23 |
The line item Input is in Time Period format in Month, and it has the formula List.Months to return the Months list items from the list. The line item Number returns the Number format of the year using the formula YEAR(Input).
| 1 | 2 | 3 | 4 | 5 | |
InputList.Months | Dec 25 | Jan 21 | Sep 22 | Jul 24 | Dec 23 |
NumberYEAR(Input) | 2,025 | 2,021 | 2,022 | 2,024 | 2,023 |
The example below shows YEAR(Value to convert). The values to convert are taken from the Product date and Year period line items. These are date and time period formatted, respectively.
| Key dates | Expiry dates | |
| Product released | 16/02/2016 | 23/08/2017 |
| Year period | Feb 16 | Aug 17 |
Product year
| 2,016 | 2,017 |
Year number
| 2,016 | 2,017 |
The next example shows YEAR(TIME. 'Period'). An explicit time reference is used instead of a line item.
| Key dates | |
Year Number
| 2,016 |
The final example shows the effect of the Time period method argument. An explicit time reference is used with a keyword to determine which date in a time period to extract the year from.
| Product: Plums | |
| Start of fiscal year | Week 1 FY2019 |
Year Start
| 2,018 |
Year Mid
| 2,019 |
Year End
| 2,019 |