Datetime Add

datetime_add

Adds a specified amount to a datetime part.

Spec

datetime_add(part, amount, datetime)

Parameters

part - The datetime part: "year", "month", "day", "hour", "minute", "second", "millisecond".
amount - An int64 value to add.
datetime - The datetime value to modify.

Return Value

A new datetime with the specified amount added.

Example

datatable(ts:datetime)[datetime(2024-01-01)]
| extend next_day = datetime_add("day", 1, ts)
tsnext_day
2024-01-01T00:00:00.0000000Z2024-01-02T00:00:00.0000000Z