Returns the year (Number
value) from Date
, DateTime
, or Time
. If a Time
value is specified, which has no year component, returns a default year. If the specified value is not a Date
, DateTime
, or Time
value, returns a blank.
Sample usage
YEAR(TODAY())
returns this year. See also: TODAY()
YEAR(TODAY()) + 1
returns next year.
YEAR(TODAY() + 365)
returns next year (unless today is January 1 of a leap year).
YEAR(TODAY()) - 1
returns last year.
YEAR([Birthday])
returns someone's birth year.
Syntax
YEAR(when)
when
- ADate
,DateTime
, orTime
value.
Note
Some constant values, such as "MM/DD/YYYY"
, are evaluated as a Date
value by AppSheet. Similarly, "000:00:00"
is evaluated as a Duration
value. This doesn't mean your spreadsheet data must use the same formats: the date and time formats in your spreadsheets are determined by the locale/language setting. Column will always be evaluated as the type of column. Additionally, you can convert data, both columns and string literals, to specific types using functions such as DATE()
, TIME()
, or DATETIME()
.