monthEnd
monthEnd, function
def const dash pure monthEnd(d: date): date
def const dash pure monthEnd(m: month): date
Returns the last day of the month containing d or represented by m.
d: input date.m: input month.
Examples
table T = with
[| as D, as M |]
[| date(2019, 12, 28), month(2019, 12) |]
[| date(2020, 1, 1), month(2020, 1) |]
[| date(2020, 2, 10), month(2020, 2) |]
show table "Month end" with
T.D
monthEnd(T.D) as "From date"
T.M
monthEnd(T.M) as "From month"
This produces the following table:
| D | From date | M | From month |
|---|---|---|---|
| 2019-12-28 | 2019-12-31 | 2019-12 | 2019-12-31 |
| 2020-01-01 | 2020-01-31 | 2020-01 | 2020-01-31 |
| 2020-02-10 | 2020-02-29 | 2020-02 | 2020-02-29 |