now()
Returns the current UTC time, optionally offset by a given timespan.
The current UTC time will stay the same across all uses of now()
in a single query statement, even if there's technically a small time difference between when each now()
runs.
Syntax
now(
[ offset ])
Parameters
Name | Type | Required | Description |
---|---|---|---|
offset | timespan | A timespan to add to the current UTC clock time. The default value is 0. |
Returns
The current UTC clock time, plus the offset time if provided, as a datetime
.
Examples
Find time elapsed from a given event
The method you create a time-interval will vary depending on your underlying database. Some databases use the INTERVAL keyword, which isn't supported in pql.
When using clickhouse, you can use minus()
, and toIntervalDay()
to create a time interval.
StormEvents
| extend Elapsed=minus(now() - StartTime)
| take 10