quarter

quarter, function

def const pure quarter(d: date): number

Returns the quarter of the year for the date d, from 1 to 4.

Example

table T = with
  [| as D |]
  [| date(2024,  1,  3) |]
  [| date(2024,  3, 16) |]
  [| date(2023, 11,  2) |]
  [| date(2022,  7, 31) |]

show table "Quarters" with
  T.D as "Date"
  quarter(T.D) as "Quarter"

This outputs the following table:

Date Quarter
2024-01-03 1
2024-03-16 1
2023-11-02 4
2022-07-31 3
User Contributed Notes
0 notes + add a note