year

year, function

def const pure year(d: date): number
def const pure year(m: month): number

Returns the Gregorian year of d or m.

Example

table T = with
  [| as D, as M |]
  [| date(2020, 1, 1), month(2020, 1) |]
  [| date(2019, 5, 1), month(2019, 12) |]

show table "Years" with
  T.D
  year(T.D) as "Year from date"
  T.M
  year(T.M) as "Year from month"

This outputs the following table:

D Year from date M Year from month
2020-01-01 2020 2020-01 2020
2019-05-01 2019 2019-12 2019

See also

User Contributed Notes
0 notes + add a note