startofyear()startofyear()
返回包含日期的一年的起点,根据偏移量移动(如提供)。Returns the start of the year containing the date, shifted by an offset, if provided.
语法Syntax
startofyear(
date [,
offset ])
startofyear(
date [,
offset ])
参数Arguments
date
:输入日期。date
: The input date.offset
:输入日期(整数,默认值为 0)中的可选偏移年数。offset
: An optional number of offset years from the input date (integer, default - 0).
返回Returns
一个日期/时间,表示给定 date 值的那一年的开始(如果指定了偏移量,则还包含该信息)。A datetime representing the start of the year for the given date value, with the offset, if specified.
示例Example
range offset from -1 to 1 step 1
| project yearStart = startofyear(datetime(2017-01-01 10:10:17), offset)
yearStartyearStart |
---|
2016-01-01 00:00:00.00000002016-01-01 00:00:00.0000000 |
2017-01-01 00:00:00.00000002017-01-01 00:00:00.0000000 |
2018-01-01 00:00:00.00000002018-01-01 00:00:00.0000000 |