On This Page

Home / Search/ Language Reference/ Functions/ Scalar Functions/ DateTime Functions/totimespan

totimespan ​

The totimespan function converts the input expression into a time interval, in seconds.

This output format differs from the standard Kusto totimespan function, which returns a timespan.

To convert datetime (Unix time) into a string, or vice versa, use the strftime and strptime functions.

Syntax ​

totimespan( Expression )

Arguments ​

  • Expression: Expression that will be converted to timespan.

Returns ​

If the conversion is successful, the result will be the number of seconds in the interval. Otherwise, the result will be null.

Example ​

This example returns 3660:

print totimespan( "0.01:01:00" )