YEAR

YEAR takes a date and returns a four-digit integer representing the year on which it falls.

Function category: Date

Syntax

YEAR(arg1)

Arguments

Description

arg1

Date object or a function that resolves to a date object.

Example

Let's say we received a response with the following insurance claim information.

{
"data":{
"claim": {
"issue_number": "2a515",
"date": "NOW()"
}
}
}

If we wanted to find the year for the value of the date field, which is set to the value of NOW, we use the following function.

# Find year based on the value of NOW from the date field
YEAR(data.claim.date)
# Returns integer which is the year at time of calling

The structure of the date response returned follows the ISO 8601 standard.