monthNum

monthNum, function

def const dash pure monthNum(d: date): number
def const dash pure monthNum(m: month): number

Returns the month number (1 to 12) for d or m.

Example

table T = with
  [| as D, as M |]
  [| date(2020, 1, 1), month(2020, 1) |]
  [| date(2020, 6, 15), month(2020, 6) |]
  [| date(2020, 12, 31), month(2020, 12) |]

show table "Month number" with
  T.D
  monthNum(T.D) as "From date"
  T.M
  monthNum(T.M) as "From month"

This produces the following table:

D From date M From month
2020-01-01 1 2020-01 1
2020-06-15 6 2020-06 6
2020-12-31 12 2020-12 12

See also

User Contributed Notes
0 notes + add a note