yearISO

yearISO, function

def const pure yearISO(d: date): number
def const pure yearISO(w: week): number

Returns the ISO week-year for a date or a week.

Example (date input)

table T = with
  [| as Label, as D |]
  [| "2019-12-28", date(2019, 12, 28) |]
  [| "2019-12-31", date(2019, 12, 31) |]
  [| "2020-01-01", date(2020, 1, 1) |]

show table "ISO years" with
  T.Label
  yearISO(T.D) as "YearISO"

This outputs the following table:

Label YearISO
2019-12-28 2019
2019-12-31 2020
2020-01-01 2020

Example (week input)

table W = with
  [| as Label, as W |]
  [| "2019-W03", week(2019, 3) |]
  [| "2019-W15", week(2019, 15) |]
  [| "2020-W01", week(2020, 1) |]

show table "ISO years" with
  W.Label
  yearISO(W.W) as "YearISO"

This outputs the following table:

Label YearISO
2019-W03 2019
2019-W15 2019
2020-W01 2020
User Contributed Notes
0 notes + add a note