totimespan()

Learn how to use the totimespan() function to convert the input to a timespan scalar value.

Converts the input to a timespan scalar value.

Syntax

totimespan(value)

Parameters

NameTypeRequiredDescription
valuestring✔️The value to convert to a timespan.

Returns

If conversion is successful, result is a timespan value. Else, result is null.

Example

The following example shows different usage of totimespan:

let value=5;
print minsStr=totimespan("0.00:03:00"), days=totimespan(4d), hour=totimespan(value * 1h), 
      mins=totimespan(value * 2m), seconds=totimespan(5 * 4s), timespanMin=timespan(25min)

Output

minsStrdayshourminssecondstimespanMin
00:03:004.00:00:0005:00:0000:10:0000:00:2000:25:00