Duration.From
Creates a duration from the given value.
Syntax
Duration.From(
value as any
) as duration
Remarks
Returns a duration
value from the given value
. If the given value
is null
, Duration.From
returns null
. If the given value
is duration
, value
is returned. Values of the following types can be converted to a duration
value:
text
: Aduration
value from textual elapsed time forms (d.h:m:s). Refer toDuration.FromText
for details.number
: Aduration
equivalent to the number of whole and fractional days expressed byvalue
.
value
is of any other type, an error is returned.
Examples
Example #1
Convert <code>2.525</code> into a <code>duration</code> value.
Duration.From(2.525)
Result:
#duration(2, 12, 36, 0)
Category
Duration