Liking cljdoc? Tell your friends :D

datahike.pg.datetime.format

to_char over timestamps, timestamptz, dates and intervals -- a port of formatting.c's DCH side (parse_format, DCH_keywords / DCH_suff, DCH_to_char), PostgreSQL 17.

Ported rather than mapped onto java.time patterns, because the two languages only look alike: PostgreSQL matches a keyword by the FIRST table entry that prefixes the input (HH12 before HH, DDD before DD), lets FM/TM prefix and TH/th/SP follow any keyword, pads a month or day NAME to nine characters, counts centuries so that 20 is 1901-2000, numbers BC years from 1 (astronomical year 0 is 1 BC), and prints a negative interval field with an extra digit of width.

The input side (to_date / to_timestamp, DCH_from_char) is not here.

`to_char` over timestamps, timestamptz, dates and intervals -- a port of
formatting.c's DCH side (parse_format, DCH_keywords / DCH_suff,
DCH_to_char), PostgreSQL 17.

Ported rather than mapped onto java.time patterns, because the two
languages only look alike: PostgreSQL matches a keyword by the FIRST
table entry that prefixes the input (`HH12` before `HH`, `DDD` before
`DD`), lets `FM`/`TM` prefix and `TH`/`th`/`SP` follow any keyword,
pads a month or day NAME to nine characters, counts centuries so that
20 is 1901-2000, numbers BC years from 1 (astronomical year 0 is 1 BC),
and prints a negative interval field with an extra digit of width.

The input side (to_date / to_timestamp, DCH_from_char) is not here.
raw docstring

do-to-timestampclj

(do-to-timestamp input fmt)

do_to_timestamp: the input parsed by fmt into {:year :mon :mday :hour :min :sec :fsec :tz (seconds WEST, or nil) :ff}.

do_to_timestamp: the input parsed by `fmt` into
{:year :mon :mday :hour :min :sec :fsec :tz (seconds WEST, or nil) :ff}.
sourceraw docstring

from-charclj

(from-char in fmt)

DCH_from_char, non-standard mode: the TmFromChar fields as a map.

DCH_from_char, non-standard mode: the TmFromChar fields as a map.
sourceraw docstring

interval-fieldsclj

(interval-fields months days micros)

interval2itm: years and months from the month count, days as they are, and the time split into hours (unbounded), minutes, seconds and microseconds, each carrying the sign.

interval2itm: years and months from the month count, days as they are,
and the time split into hours (unbounded), minutes, seconds and
microseconds, each carrying the sign.
sourceraw docstring

parse-formatclj

(parse-format fmt)

parse_format for the DCH flag: a vector of nodes, either {:key id :suffix #{…}} for a keyword or {:text s} for literal output.

parse_format for the DCH flag: a vector of nodes, either
{:key id :suffix #{…}} for a keyword or {:text s} for literal output.
sourceraw docstring

timestamp-fieldsclj

(timestamp-fields t)

A timestamp's fields: its wall clock as it stands.

A timestamp's fields: its wall clock as it stands.
sourceraw docstring

timestamptz-fieldsclj

(timestamptz-fields i zone)

A timestamptz's fields: its wall clock in zone, with that zone's offset and abbreviation at the instant.

A timestamptz's fields: its wall clock in `zone`, with that zone's
offset and abbreviation at the instant.
sourceraw docstring

to-charclj

(to-char tm interval? fmt)

DCH_to_char over tm, a map of the broken-down value: :year (astronomical) :mon :mday :hour :min :sec :usec, plus :yday and :wday for a timestamp, and :gmtoff / :tzn for a timestamptz. interval? selects the interval rules.

DCH_to_char over `tm`, a map of the broken-down value:
:year (astronomical) :mon :mday :hour :min :sec :usec, plus :yday and
:wday for a timestamp, and :gmtoff / :tzn for a timestamptz.
`interval?` selects the interval rules.
sourceraw docstring

to-dateclj

(to-date input fmt)

to_date(text, text).

`to_date(text, text)`.
sourceraw docstring

to-timestampclj

(to-timestamp input fmt zone)

to_timestamp(text, text): the parsed wall clock placed by the zone the input gave, else by zone (the session's), then rounded to the FFn precision if one was given (AdjustTimestampForTypmod, which rounds half away from zero measured from PostgreSQL's 2000-01-01 epoch).

`to_timestamp(text, text)`: the parsed wall clock placed by the zone
the input gave, else by `zone` (the session's), then rounded to the
FFn precision if one was given (AdjustTimestampForTypmod, which rounds
half away from zero measured from PostgreSQL's 2000-01-01 epoch).
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close