---
title: year()
slug: year
docTags: 
createdAt: 2021-09-14T17:49:55.000Z
---

Returns the Gregorian calendar year of a particular date.

### Syntax

`year(date)`

- `date` - the date from which to extrapolate the year
- **Return type:** [Number](docId\:ucI5tCTfVBhonEJ6ZQijg)&#x20;

### Sample usage

`year('2020-05-12')` returns `2020`.

### Supported data types

| **Input type**                            | **Return type**                         | **Logic**                                                                  |
| ----------------------------------------- | --------------------------------------- | -------------------------------------------------------------------------- |
| ****[Date](docId\:xTAQdzvLBTAKjxRnpFwe9)  | [Number](docId\:ucI5tCTfVBhonEJ6ZQijg)  | If a Date is passed, the year corresponding to that date will be returned. |
| *Unsupported data types*                  | **[Null](docId\:N9trVqonnBknqL9DrNBP6)  | Unsupported data types return `Null`.                                      |

