# $getYear

`$getYear` operator returns you the year of the date. You can use this in any [Expression Object](https://docs.cosmocloud.io/concepts-and-in-depth/cql-cosmocloud-query-language/building-expressions)

## Syntax

```
{
    "$getYear": [<date_like_obj>]
}
```

## Properties

| Field              | Description                                                                                                                                                                     | Required |
| ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------- |
| \<date\_like\_obj> | <p>The \<date\_like\_obj> expression can be any valid expression as long as it resolves to datetime objects.<br><br>It can also be a <strong>Magical Autocomplete</strong>.</p> | true     |

## Returns

`integer` - The year of the date provided

## Examples

### Basic Example

```
{
    "$getYear": ["2025-03-20 00:00:00"]
}
```

The above expression returns **2025**

### With Magical Autocomplete

Let's say we have declared a variable `temp` of type `datetime` which has value of `2025-03-20 00:00:00` currently.

```
{
    "$getYear": [ "$.variables.temp" ]
}
```

The above expression would resolve to a result of **2025**
