duration Module
Create, manipulate, and format durations representing spans of time.
Constructors
duration::years
Create a duration of the specified number of years.
duration::months
Create a duration of the specified number of months.
duration::weeks
Create a duration of the specified number of weeks.
duration::days
Create a duration of the specified number of days.
duration::hours
Create a duration of the specified number of hours.
duration::minutes
Create a duration of the specified number of minutes.
duration::seconds
Create a duration of the specified number of seconds.
duration::millis
Create a duration of the specified number of milliseconds.
Component Extraction
Arithmetic
Formatting
Function Reference
| Function | Description |
|---|---|
| duration::years | Create a duration of the specified number of years. |
| duration::months | Create a duration of the specified number of months. |
| duration::weeks | Create a duration of the specified number of weeks. |
| duration::days | Create a duration of the specified number of days. |
| duration::hours | Create a duration of the specified number of hours. |
| duration::minutes | Create a duration of the specified number of minutes. |
| duration::seconds | Create a duration of the specified number of seconds. |
| duration::millis | Create a duration of the specified number of milliseconds. |
| duration::get_months | Get the months component of a duration. |
| duration::get_days | Get the days component of a duration. |
| duration::get_nanos | Get the nanoseconds component of a duration. |
| duration::add | Add two durations together. |
| duration::subtract | Subtract one duration from another. |
| duration::negate | Negate a duration (flip its sign). |
| duration::scale | Scale a duration by a numeric factor. |
| duration::trunc | Truncate a duration to a specified precision. |
| duration::format | Format a duration as a human-readable string. |
