Extract Minutes From UTC
Extract Minutes From UTC — Chronos Documentation.
extractMinutesFromUTC
Converts a UTC offset string in UTC±HH:MM format into total minutes as a number.
Function Signature
extractMinutesFromUTC(utc: UTCOffset): number;Parameters
utc: A UTC offset string in format:UTC+HH:MM(positive offset)UTC-HH:MM(negative offset)
Returns
The total minutes represented by the UTC offset:
- Positive number for east of UTC (e.g.,
330forUTC+05:30) - Negative number for west of UTC (e.g.,
-240forUTC-04:00) 0forUTC+00:00
Example Usage
playground.ts
Notes
- Only accepts valid
UTCOffsetformatted strings - Minutes are calculated as
(hours * 60) + minutes - Returns 0 for UTC+00:00
- Maintains sign convention (negative for west of UTC)
- Works with all quarter-hour increments (00, 15, 30, 45 minutes)
Aliases
getMinutesFromUTCgetTotalMinutesFromUTC
Use Cases
- Timezone offset calculations
- Timezone-aware scheduling
- International time comparisons
- UTC conversion utilities
Type Definitions
type PositiveUTCHour = '+00'|'+01'|...|'+14';
type NegativeUTCHour = '-00'|'-01'|...|'-14';
type UTCMinute = '00'|'15'|'30'|'45';
type UTCOffset = `UTC${PositiveUTCHour | NegativeUTCHour}:${UTCMinute}`;Conclusion
The extractMinutesFromUTC function provides:
- Simple conversion from UTC strings to numeric minutes
- Accurate timezone math for calculations
- Consistent handling of positive/negative offsets
- Type-safe operations through strict input validation
Last updated: Fri, May 22, 2026 07:46:19AM (Coordinated Universal Time)
