> ## Documentation Index
> Fetch the complete documentation index at: https://docs.metrics-man.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Year

# \$year

The `$year` operator extracts the year component from a date object.

## Input

* A single date object

## Output

* The year component of the date as an integer

## Examples

### Extract Year from Date

```json theme={null}
{
  "$year": [
    {
      "$toDate": ["2023-01-15T10:30:00Z"]
    }
  ]
}
```

Result: `2023`

### Extract Year from Field

```json theme={null}
{
  "$year": [
    {
      "$input": "birth_date"
    }
  ]
}
```

Result: The year component of the birth\_date field
