Date/time Functions
PantherFlow date/time functions
time.add()
time.add()time.add(timestamp: timestamp, value: int, unit: string) -> timestamp
Return timestamp added to a timespan created by combining value with a time unit, such as "hour". value can be a column which allows for more expressive timestamp arithmetic than directly adding timespan constants. Subtraction can be achieved by providing a negative value. unit can be:
year,ymonthday,dhour,hminute,msecond,s
More values may be accepted, but are not guaranteed to be supported in future releases.
Example:
let timebins =
range N from 1 to 10 step 1
| project t1=time.add(time.now(), N, 'day')time.ago()
time.ago()time.ago(span: timespan) -> timestamp
Returns the timestamp that is span ago.
Example:
time.diff()
time.diff()time.diff(unit: string, timestamp1: timestamp, timestamp2: timestamp) -> int
Calculates the difference between two timestamps based on the date or time unit requested. The function returns the result of subtracting timestamp1 from timestamp2 (i.e. timestamp2 - timestamp1). unit can be:
year,ymonthday,dhour,hminute,msecond,s
More values may be accepted, but are not guaranteed to be supported in future releases.
Example:
time.now()
time.now()time.now() -> timestamp
Returns the current timestamp.
Example:
time.parse_timespan()
time.parse_timespan()time.parse_timespan(str: string) -> timespan
Returns the timespan representation of the duration string.
Example:
time.parse_timestamp()
time.parse_timestamp()time.parse_timestamp(str: string) -> timestamp
Returns the timestamp representation of the timestamp string.
Example:
time.slice()
time.slice()time.slice(time: timestamp, slice_length: int, slice_unit: string) -> timestamp
Returns the timestamp that time resides in, given chunks of slice_unit and slice_length. For example, if slice_length is 1 and slice_unit is "hour", the time is truncated to the hour it belongs to. Slices are calculated relative to midnight January 1, 1970. slice_unit can be:
year,ymonthday,dhour,hminute,msecond,s
More values may be accepted, but are not guaranteed to be supported in future releases.
Example:
time.trunc()
time.trunc()time.trunc(unit: string, timestamp: timestamp) -> timestamp
Returns the timestamp truncated to the specified unit. unit can be:
year,ymonthday,dhour,hminute,msecond,s
More values may be accepted, but are not guaranteed to be supported in future releases.
Example:
Last updated
Was this helpful?

