$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
2023
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
$year operator extracts the year component from a date object.
{
"$year": [
{
"$toDate": ["2023-01-15T10:30:00Z"]
}
]
}
2023
{
"$year": [
{
"$input": "birth_date"
}
]
}
