共用方式為


endofmonth()

傳回包含該日期的當月結束日期,若有位移的話則移位。

語法

endofmonth(date [, offset])

深入瞭解 語法慣例

參數

名稱 類型 必要 Description
date datetime ✔️ 用來尋找月份結束的日期。
offset int 日期起的位移月份數目。 預設值為 0。

傳回

datetime,表示指定 日期 值的月份結尾,如果有指定 移,則為 。

範例

  range offset from -1 to 1 step 1
 | project monthEnd = endofmonth(datetime(2017-01-01 10:10:17), offset) 

輸出

monthEnd
2016-12-31 23:59:59.9999999
2017-01-31 23:59:59.9999999
2017-02-28 23:59:59.9999999