endofyear()

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

語法

endofyear(date [, offset])

深入瞭解 語法慣例

參數

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

傳回

日期時間,代表指定 日期 值的年份結尾,如果指定,則為 &位移

範例

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

輸出

yearEnd
2016-12-31 23:59:59.9999999
2017-12-31 23:59:59.9999999
2018-12-31 23:59:59.9999999