Duration Built-ins¶
The Duration Built-ins create an object that represents a specified amount of time.
Syntax
1 | <duration Duration> := duration(<amount Number>, <unit String>) |
Returns
A duration
object representing the provided amount of the specified unit type.
Parameters
-
amount - A number representing the quantity of units, represented by the duration object result
-
unit - The type of unit represented by the duration object result
- May be one of (case-insensitive):
millisecond
/milliseconds
,second
/seconds
,minute
/minutes
,hour
/hours
,day
/days
,week
/weeks
,month
/months
oryear
/years
- May be one of (case-insensitive):
Example
1 2 3 4 5 | Given create a duration of 5 "seconds" stepdef "create a duration of {} {}" / number, unit / duration := duration(number, unit) println(duration) end |
The example above creates a duration object representing five seconds.