Dates and durations as they appear in feeds, parsed leniently and formatted canonically, from arithmetic and regular expressions alone so that the JVM and JavaScript agree.
Instants are inst values, java.util.Date or js/Date. Durations and timestamps within media are seconds: a long when whole, and a double otherwise.
Dates and durations as they appear in feeds, parsed leniently and formatted canonically, from arithmetic and regular expressions alone so that the JVM and JavaScript agree. Instants are inst values, java.util.Date or js/Date. Durations and timestamps within media are seconds: a long when whole, and a double otherwise.
(->inst ms)The instant ms milliseconds after the epoch.
The instant `ms` milliseconds after the epoch.
(date inst)The instant inst, of any kind that inst? takes, as the instant of the
platform: java.util.Date on the JVM, and js/Date in JavaScript.
A java.time.Instant, which EDN can't print, comes out as one that EDN writes as an inst.
The instant `inst`, of any kind that inst? takes, as the instant of the platform: java.util.Date on the JVM, and js/Date in JavaScript. A java.time.Instant, which EDN can't print, comes out as one that EDN writes as an inst.
(earliest & instants)The earliest of the instants, with nils left out, or nil when none is
left, e.g. a due time brought forward to the longest wait of an app.
The earliest of the `instants`, with nils left out, or nil when none is left, e.g. a due time brought forward to the longest wait of an app.
(finite? x)Whether x is a number that's neither infinite nor NaN.
Whether `x` is a number that's neither infinite nor NaN.
(floor-seconds inst)The instant inst with its milliseconds dropped, the precision an RFC
2822 date can carry.
The instant `inst` with its milliseconds dropped, the precision an RFC 2822 date can carry.
(format-clock seconds)The seconds as "H:MM:SS", or "M:SS" under an hour, without any
fraction of a second and with a minus sign when negative. It's nil when
seconds isn't a number, or is beyond max-whole.
The `seconds` as "H:MM:SS", or "M:SS" under an hour, without any fraction of a second and with a minus sign when negative. It's nil when `seconds` isn't a number, or is beyond max-whole.
(format-iso8601 inst)The instant inst as ISO 8601 in UTC, e.g. "2026-09-25T16:42:40Z", with
milliseconds only when they aren't zero.
The instant `inst` as ISO 8601 in UTC, e.g. "2026-09-25T16:42:40Z", with milliseconds only when they aren't zero.
(format-rfc2822 inst)The instant inst as an RFC 2822 date in GMT, e.g.
"Fri, 25 Sep 2026 16:42:40 GMT".
The instant `inst` as an RFC 2822 date in GMT, e.g. "Fri, 25 Sep 2026 16:42:40 GMT".
(format-timestamp seconds)(format-timestamp seconds separator)The seconds as the "HH:MM:SS.mmm" timestamp of WebVTT and Podlove
Simple Chapters, or of SRT with "," as separator.
A negative time, which those formats lack, is zero. It's nil when
seconds isn't a number, or is beyond max-whole.
The `seconds` as the "HH:MM:SS.mmm" timestamp of WebVTT and Podlove Simple Chapters, or of SRT with "," as `separator`. A negative time, which those formats lack, is zero. It's nil when `seconds` isn't a number, or is beyond max-whole.
(later at seconds)The instant seconds after the instant at.
The instant `seconds` after the instant `at`.
(latest & instants)The latest of the instants, with nils left out, or nil when none is
left, e.g. a due time held back by the not-before of a server.
The latest of the `instants`, with nils left out, or nil when none is left, e.g. a due time held back by the not-before of a server.
(now)The instant now, by the clock of the platform.
The instant now, by the clock of the platform.
(parse-clock s)The seconds of the clock-style timestamp s, such as "1:02:03",
"02:03", "00:00:02.760" or the SRT-style "00:00:02,760", or nil when
s isn't one. Without hours, the minutes can pass 59, e.g. "103:12".
The seconds of the clock-style timestamp `s`, such as "1:02:03", "02:03", "00:00:02.760" or the SRT-style "00:00:02,760", or nil when `s` isn't one. Without hours, the minutes can pass 59, e.g. "103:12".
(parse-date s)The instant of s as an RFC 2822 date, or else as ISO 8601, or nil when
it's neither.
The instant of `s` as an RFC 2822 date, or else as ISO 8601, or nil when it's neither.
(parse-duration s)The seconds of the duration s, as itunes:duration writes it, or nil
when it doesn't read. It's plain seconds, e.g. "3793" or "3793.5", or
a clock, e.g. "1:03:13" or "63:13".
The seconds of the duration `s`, as itunes:duration writes it, or nil when it doesn't read. It's plain seconds, e.g. "3793" or "3793.5", or a clock, e.g. "1:03:13" or "63:13".
(parse-iso8601 s)The instant of the ISO 8601 date or date-time s, or nil, as for a day
or a time that doesn't exist. A missing zone reads as UTC.
The instant of the ISO 8601 date or date-time `s`, or nil, as for a day or a time that doesn't exist. A missing zone reads as UTC.
(parse-rfc2822 s)The instant of the RFC 2822 date s, or nil when it isn't a date at
all, or names a day or a time that doesn't exist, such as 31 February.
It forgives the deviations that feeds are known for:
The instant of the RFC 2822 date `s`, or nil when it isn't a date at all, or names a day or a time that doesn't exist, such as 31 February. It forgives the deviations that feeds are known for: - a missing weekday - full month names - two-digit years - zone names - missing seconds - a missing or unknown zone, which reads as UTC
(rfc2822-strict? s)Whether s is a date that RFC 2822 permits, written the way that RSS
feeds are expected to write it, on a day and at a time that exist.
Whether `s` is a date that RFC 2822 permits, written the way that RSS feeds are expected to write it, on a day and at a time that exist.
(seconds x)The number of seconds that x denotes: a number as it is, or a numeric
or clock string as itunes:duration writes it, and nil for anything
else.
The number of seconds that `x` denotes: a number as it is, or a numeric or clock string as itunes:duration writes it, and nil for anything else.
(unix-seconds inst)The whole seconds from the epoch to the instant inst, as Unix time
counts them.
The whole seconds from the epoch to the instant `inst`, as Unix time counts them.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |