duration Module

Create, manipulate, and format durations representing spans of time.

Constructors

Component Extraction

Arithmetic

Formatting

Function Reference

FunctionDescription
duration::yearsCreate a duration of the specified number of years.
duration::monthsCreate a duration of the specified number of months.
duration::weeksCreate a duration of the specified number of weeks.
duration::daysCreate a duration of the specified number of days.
duration::hoursCreate a duration of the specified number of hours.
duration::minutesCreate a duration of the specified number of minutes.
duration::secondsCreate a duration of the specified number of seconds.
duration::millisCreate a duration of the specified number of milliseconds.
duration::get_monthsGet the months component of a duration.
duration::get_daysGet the days component of a duration.
duration::get_nanosGet the nanoseconds component of a duration.
duration::addAdd two durations together.
duration::subtractSubtract one duration from another.
duration::negateNegate a duration (flip its sign).
duration::scaleScale a duration by a numeric factor.
duration::truncTruncate a duration to a specified precision.
duration::formatFormat a duration as a human-readable string.