Bemærk
Adgang til denne side kræver godkendelse. Du kan prøve at logge på eller ændre mapper.
Adgang til denne side kræver godkendelse. Du kan prøve at ændre mapper.
Switch services using the Version drop-down list. Learn more about navigation.
Applies to: ✅ Microsoft Fabric ✅ Azure Data Explorer ✅ Azure Monitor ✅ Microsoft Sentinel
Returns the start of the year containing the date, shifted by an offset, if provided.
Syntax
startofyear(date [, offset ])
Learn more about syntax conventions.
Parameters
| Name | Type | Required | Description |
|---|---|---|---|
| date | datetime |
✔️ | The date for which to find the start of the year. |
| offset | int |
The number of years to offset from the input date. The default is 0. |
Returns
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)
Output
| yearStart |
|---|
| 2016-01-01 00:00:00.0000000 |
| 2017-01-01 00:00:00.0000000 |
| 2018-01-01 00:00:00.0000000 |