(parse s)(parse s opts)Parse a string s into a java.time value. For epoch millis, prefer
parse->millis.
Arities:
opts map:
Behavior:
Parse a string `s` into a java.time value. For epoch millis, prefer
`parse->millis`.
Arities:
- (parse s) ; ISO-8601 only (strict default for these built-ins)
- (parse s opts)
opts map:
- :format or :formatter — required for non-ISO inputs
- :resolver-style — :strict | :smart | :lenient (only used with :format)
- :zone — ZoneId or zone string for resolving LocalDate/LocalDateTime later
(not needed if the parsed value has an offset/zone)
Behavior:
- Without :format/:formatter, attempts standard ISO parsers in order:
Instant → OffsetDateTime → ZonedDateTime → LocalDateTime → LocalDate.
- With :format/:formatter, tries the same order with the given formatter.
- LocalTime by itself is not supported (throws).(parse-with-formatter s fmt)Parse s with a DateTimeFormatter and return the first successfully
materialized temporal among: OffsetDateTime, ZonedDateTime, LocalDateTime, LocalDate.
Parse `s` with a DateTimeFormatter and return the first successfully materialized temporal among: OffsetDateTime, ZonedDateTime, LocalDateTime, LocalDate.
(resolve-formatter {:keys [formatter format resolver-style] :as _opts})Resolve a DateTimeFormatter from either:
{:formatter f} where f is a DateTimeFormatter (returned as-is), or{:format pattern} where pattern is a java.time pattern string.
Optional :resolver-style ∈ #{:strict :smart :lenient}. If absent, we leave the
DateTimeFormatter's default (SMART) as-is.Resolve a DateTimeFormatter from either:
- `{:formatter f}` where f is a DateTimeFormatter (returned as-is), or
- `{:format pattern}` where pattern is a java.time pattern string.
Optional `:resolver-style` ∈ #{:strict :smart :lenient}. If absent, we leave the
DateTimeFormatter's default (SMART) as-is.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 |