A Duration stores elapsed time, not a clock time. Constructors such as Hours create durations; converters such as ToHours return numbers.
Abs
Returns the non-negative magnitude of a number or duration.
- Syntax:
Abs(value)
- Requires: a Numeric or Duration value.
- Returns: the same type as the input.
- Best for: unsigned differences and normalising reversed intervals.
Days
Creates a duration from a number of days.
- Syntax:
Days(number)
- Requires: a Numeric value; fractions and negative values are allowed.
- Returns: Duration.
- Best for: service windows and adding days as elapsed time.
Hours
Creates a duration from a number of hours.
- Syntax:
Hours(number)
- Requires: a Numeric value; fractions and negative values are allowed.
- Returns: Duration.
- Best for: labour, travel, and operating-time calculations.
Minutes
Creates a duration from a number of minutes.
- Syntax:
Minutes(number)
- Requires: a Numeric value; fractions and negative values are allowed.
- Returns: Duration.
- Best for: appointment lengths and short service windows.
Mod
Returns the mathematical modulus after division.
- Syntax:
Mod(dividend, divisor)
- Requires: two Numeric values or two Duration values. The divisor cannot be zero; do not mix numbers and durations.
- Returns: Numeric or Duration, matching the inputs.
- Best for: repeating cycles where a non-negative result is wanted with a positive divisor.
The non-zero result follows the sign of the divisor. This differs from Rem for some negative inputs.
Rem
Returns the remainder after division.
- Syntax:
Rem(dividend, divisor)
- Requires: two Numeric values or two Duration values. The divisor cannot be zero; do not mix numbers and durations.
- Returns: Numeric or Duration, matching the inputs.
- Best for: direct remainder calculations that preserve the dividend’s direction.
The non-zero result follows the sign of the dividend.
Seconds
Creates a duration from a number of seconds.
- Syntax:
Seconds(number)
- Requires: a Numeric value; fractions and negative values are allowed.
- Returns: Duration.
- Best for: precise integration delays and elapsed measurements.
ToDays
Converts a duration to its total number of days.
- Syntax:
ToDays(duration)
- Requires: a Duration value.
- Returns: Numeric, including any fractional day.
- Best for: reports and comparisons expressed in days.
ToHours
Converts a duration to its total number of hours.
- Syntax:
ToHours(duration)
- Requires: a Duration value.
- Returns: Numeric, including any fractional hour.
- Best for: timesheets and labour totals.
ToMinutes
Converts a duration to its total number of minutes.
- Syntax:
ToMinutes(duration)
- Requires: a Duration value.
- Returns: Numeric, including any fractional minute.
- Best for: service-time and appointment reports.
ToSeconds
Converts a duration to its total number of seconds.
- Syntax:
ToSeconds(duration)
- Requires: a Duration value.
- Returns: Numeric, including any fractional second.
- Best for: precise integrations and measurement exports.
ToWeeks
Converts a duration to its total number of seven-day weeks.
- Syntax:
ToWeeks(duration)
- Requires: a Duration value.
- Returns: Numeric, including any fractional week.
- Best for: long service windows and age summaries.
Weeks
Creates a duration from a number of seven-day weeks.
- Syntax:
Weeks(number)
- Requires: a Numeric value; fractions and negative values are allowed.
- Returns: Duration.
- Best for: long validity periods and elapsed-time rules.
Days(1) always means 24 elapsed hours. Use date functions such as AdjustMonth or Workday for calendar-aware movement.