Skip to content

Durations

imshooter edited this page Nov 26, 2026 · 1 revision

Reading

DurationParse reads numbers each followed by a unit, in any case, with spaces anywhere between them, as 90s, 1h 30m or 2d12h:

Unit Is
ms A millisecond.
s A second.
m A minute.
h An hour.
d A day.
w A week.
y A year of 365 days.

Milliseconds stop at 24 days in a cell, so DurationParseSeconds reads the same text into seconds, which reach 68 years.

Writing

DurationFormat writes words when given no format, leaving out what is zero: 1 day, 2 hours, 3 minutes, 4 seconds.

With a format, %y, %d, %h, %m and %s write years of 365 days, days, hours, minutes and seconds, in two digits when in capitals. Each holds what the larger ones in the format leave, so the largest holds all the rest:

Format 93784 seconds
%H:%M:%S, as DURATION_CLOCK 26:03:04
%d %H:%M:%S 1 02:03:04
%dd %hh %mm %ss 1d 2h 3m 4s
%m:%S 1563:04

Clone this wiki locally