你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn。
startofweek()
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Returns the start of the week containing the date, shifted by an offset, if provided.
Start of the week is considered to be a Sunday.
Syntax
startofweek(
date [,
offset ])
Learn more about syntax conventions.
Parameters
Name | Type | Required | Description |
---|---|---|---|
date | datetime |
✔️ | The date for which to find the start of week. |
offset | int |
The number of weeks to offset from the input date. The default is 0. |
Returns
A datetime representing the start of the week for the given date value, with the offset, if specified.
Example
range offset from -1 to 1 step 1
| project weekStart = startofweek(datetime(2017-01-01 10:10:17), offset)
Output
weekStart |
---|
2016-12-25 00:00:00.0000000 |
2017-01-01 00:00:00.0000000 |
2017-01-08 00:00:00.0000000 |