Duration of

Date and time Pure
Duration of
Amount 0
Result
Unit(Duration unit) Seconds

Description

Pure function building a duration from an amount and a unit (e.g. 5 MINUTES).

When to use

Use Duration of to construct a typed duration from a human-readable amount and unit — for example, 30 Minutes or 7 Days. Feed the result into Add duration to shift a datetime forward or backward. For measuring elapsed time between two datetimes, use Duration between instead.

Pins

Input pins

Pin Type Default Notes
Amount integer 0 The number of units. May be negative to represent a duration that goes backward in time.
Unit Duration unit Seconds The unit of the amount — Milliseconds, Seconds, Minutes, Hours, or Days.

Output pins

Pin Type Notes
Result duration The constructed duration value.

Example

Calculate a deadline that is 7 days from now. Wire the Result output of Now into the Value input of Add duration, and wire the Result output of Duration of (Amount set to 7, Unit set to Days) into the Duration input. Feed the Result output of Add duration into Format date/time to produce a readable deadline string.

See also