Utility functions for programmatically building a DateTimeFormatter
. Easier to understand than chaining a hundred
Java calls and trying to keep the structure straight.
The basic idea here is you pass a number of sections
to formatter
to build a DateTimeFormatter
— see
second-date.parse
for examples. Most of these sections are simple wrappers around corresponding
DateTimeFormatterBuilder
-- see
https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatterBuilder.html for documentation.
Utility functions for programmatically building a `DateTimeFormatter`. Easier to understand than chaining a hundred Java calls and trying to keep the structure straight. The basic idea here is you pass a number of `sections` to `formatter` to build a `DateTimeFormatter` — see `second-date.parse` for examples. Most of these sections are simple wrappers around corresponding `DateTimeFormatterBuilder` -- see https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatterBuilder.html for documentation.
(case-insensitive & sections)
Make wrapped sections
case-insensitive.
Make wrapped `sections` case-insensitive.
(case-sensitive & sections)
Make wrapped sections
case-sensitive.
Make wrapped `sections` case-sensitive.
(default-value temporal-field-name default-val)
Define a section that sets a default value for a field like :minute-of-hour
.
Define a section that sets a default value for a field like `:minute-of-hour`.
(formatter & sections)
Return a new DateTimeFormatter
from sections
. See examples in second-date.parse
for more details.
(formatter (case-insensitive (value :hour-of-day 2) (optional ":" (value :minute-of-hour 2) (optional ":" (value :second-of-minute)))))
->
#object[java.time.format.DateTimeFormatter "ParseCaseSensitive(false)Value(HourOfDay,2)[':'Value(MinuteOfHour,2)[':'Value(SecondOfMinute)]]"]
Return a new `DateTimeFormatter` from `sections`. See examples in `second-date.parse` for more details. (formatter (case-insensitive (value :hour-of-day 2) (optional ":" (value :minute-of-hour 2) (optional ":" (value :second-of-minute))))) -> #object[java.time.format.DateTimeFormatter "ParseCaseSensitive(false)Value(HourOfDay,2)[':'Value(MinuteOfHour,2)[':'Value(SecondOfMinute)]]"]
(fraction temporal-field-name
_min-val-width
_max-val-width
&
{:keys [decimal-point?]})
Define a section for a fractional value, e.g. milliseconds or nanoseconds.
Define a section for a fractional value, e.g. milliseconds or nanoseconds.
(lenient & sections)
Use lenient parsing for wrapped sections
.
Use lenient parsing for wrapped `sections`.
(optional & sections)
Make wrapped sections
optional.
Make wrapped `sections` optional.
(strict & sections)
Use strict parsing for wrapped sections
.
Use strict parsing for wrapped `sections`.
(value temporal-field-name)
(value temporal-field-name width)
(value temporal-field-name min-val max-val sign-style-name)
Define a section for a specific field such as :hour-of-day
or :minute-of-hour
. Refer to
second-date.common/temporal-field
for all possible temporal fields names.
Define a section for a specific field such as `:hour-of-day` or `:minute-of-hour`. Refer to `second-date.common/temporal-field` for all possible temporal fields names.
(zone-id)
An a section for a timezone ID wrapped in square brackets, e.g. [America/Los_Angeles]
.
An a section for a timezone ID wrapped in square brackets, e.g. `[America/Los_Angeles]`.
(zone-offset)
Define a section for a timezone offset. e.g. -08:00
.
Define a section for a timezone offset. e.g. `-08:00`.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close