Returns the difference between this ClockTime and another in the specified unit(s). Supports microsecond precision when 'microseconds' is included in the unit parameter.
Object with only the specified units (or all units if not specified)
const t1 = ClockTime.fromObject({ hour: 15, minute: 30 })
const t2 = ClockTime.fromObject({ hour: 14, minute: 0 })
t1.diff(t2, 'hours') // { hours: 1 }
t1.diff(t2, ['hours', 'minutes']) // { hours: 1, minutes: 30 }
t1.diff(t2) // { hours: 1, minutes: 30, seconds: 0, milliseconds: 0, microseconds: 0 }
Returns true if this ClockTime equals another ClockTime.
true if times are equal
Returns a new ClockTime with the given time units set.
Object with time units to set (hour, minute, second, millisecond, microsecond)
A new ClockTime
Returns a new ClockTimeTz with the timezone changed. The time value changes to reflect the same instant in the new timezone.
The timezone to convert to
A new ClockTimeTz in the specified timezone
Returns the underlying DateTime instance.
A DateTime representing this time with zone
Returns the time as an ISO 8601 time string with timezone offset.
Alias for toISOTime().
Optionalopts: {Optional format options
Optionalformat?: "basic" | "extended"Format variant: 'basic' (compact) or 'extended' (default, with colons)
OptionalsuppressMilliseconds?: booleanIf true, omits milliseconds/microseconds when they are zero
OptionalsuppressSeconds?: booleanIf true, omits seconds when they are zero
ISO time string with timezone offset (e.g., '14:30:45.123456-05:00')
Returns the time as an ISO 8601 time string with timezone offset.
Alias for toISO().
Optionalopts: {Optional format options
Optionalformat?: "basic" | "extended"Format variant: 'basic' (compact) or 'extended' (default, with colons)
OptionalsuppressMilliseconds?: booleanIf true, omits milliseconds/microseconds when they are zero
OptionalsuppressSeconds?: booleanIf true, omits seconds when they are zero
ISO time string with timezone offset (e.g., '14:30:45.123456-05:00')
Returns a localized string representation of the time.
OptionalformatOpts: DateTimeFormatOptionsIntl.DateTimeFormat options for formatting
Optionalopts: LocaleOptionsOptional locale configuration
Locale string (e.g., 'en-US', 'fr-FR')
Numbering system (e.g., 'arab', 'beng')
Calendar system (e.g., 'islamic', 'hebrew')
Localized time string
Alias of toSQL.
Returns the SQL time string without timezone offset.
Result is memoized for performance.
SQL time string without timezone offset (e.g., '14:30:45.123456')
ProtectedwrapStaticfromStaticfromCreate a ClockTimeTz from a custom format string. Uses Luxon format tokens (e.g., 'HH:mm:ss', 'hh:mm a').
The string to parse
Format string using Luxon tokens
Optionalopts: DateTimeOptionsOptional configuration
Timezone to interpret the time in (IANA timezone name or Zone object)
Locale for parsing (e.g., 'en-US', 'fr-FR')
Numbering system (e.g., 'arab', 'beng')
Output calendar system (e.g., 'islamic', 'hebrew')
A ClockTimeTz for the parsed time
StaticfromCreate a ClockTimeTz from an ISO 8601 time string. If the string includes timezone information, it will be used. If no timezone is in the string, it will be interpreted as UTC.
ISO time string (e.g., '14:30:45.123456-05:00')
A ClockTimeTz for the given time
StaticfromCreate a ClockTimeTz from a JavaScript Date.
A JavaScript Date instance
A ClockTimeTz for the time portion
StaticfromCreate a ClockTimeTz from an object with time units.
Object with hour, minute, second, millisecond, microsecond properties
Optionalopts: DateTimeJSOptionsOptional configuration
Timezone for the time (IANA timezone name or Zone object, defaults to UTC)
Locale (e.g., 'en-US', 'fr-FR')
Numbering system (e.g., 'arab', 'beng')
Output calendar system (e.g., 'islamic', 'hebrew')
A ClockTimeTz for the given components
ClockTimeTz.fromObject({ hour: 14, minute: 30, second: 45 }) // UTC by default
// Note for when sending a named, non-UTC time zone, soch as 'America/New_York':
// Sending a non-UTC time zone will interpret the time zone based on DateTime.now,
// meaning the resulting ClockTimeTz will have a different time and offset when
// generated during daylight savings time than not during daylight savings time
ClockTimeTz.fromObject({ hour: 14, minute: 30 }, { zone: 'America/New_York' })
StaticfromCreate a ClockTimeTz from an SQL time string. If no zone option is provided, the time will be interpreted as UTC.
SQL time string (e.g., '14:30:45.123456')
A ClockTimeTz for the given time
StaticmaxReturns the latest ClockTime/ClockTimeTz from the given arguments.
The latest ClockTime/ClockTimeTz
StaticminReturns the earliest ClockTime/ClockTimeTz from the given arguments.
The earliest ClockTime/ClockTimeTz
StaticnowReturns a ClockTime for the current time.
Optionalopts: { zone?: string | Zone }A ClockTime for now
Protected Staticwrap
ClockTimeTz represents a time of day with timezone information.
Useful for representing TIME WITH TIME ZONE fields from a Postgres database. All output methods include timezone offset information.