Liking cljdoc? Tell your friends :D

tupelo.java-time


*zone-id*clj

source

->year-quarterclj

(->year-quarter arg)

Inputs: [arg] Returns: tsk/Quarter

Given a date-ish value (e.g. LocalDate, et al), returns the quarter of the year as one of #{ :Q1 :Q2 :Q3 :Q4 }

Inputs: [arg]
Returns: tsk/Quarter

Given a date-ish value (e.g. LocalDate, et al), returns the quarter of the year
as one of #{ :Q1 :Q2 :Q3 :Q4 } 
sourceraw docstring

betweenclj

(between chrono-unit t1 t2)

Inputs: [chrono-unit :- ChronoUnit t1 :- Temporal t2 :- Temporal] Returns: s/Int

Returns the integer number of ChronoUnit values between two temporal values, truncating any fraction. Example:

  (let [i1      (->Instant "1987-11-22t01:30:00z")
        i2      (->Instant "1987-11-22t03:29:00z")
        delta   (between ChronoUnit/HOURS i1 i2) ]  ...)

yields delta=1 since 1hr 59min is truncated to 1 hour.

Inputs: [chrono-unit :- ChronoUnit t1 :- Temporal t2 :- Temporal]
Returns: s/Int

Returns the integer number of ChronoUnit values between two temporal values, truncating any fraction.
 Example:

      (let [i1      (->Instant "1987-11-22t01:30:00z")
            i2      (->Instant "1987-11-22t03:29:00z")
            delta   (between ChronoUnit/HOURS i1 i2) ]  ...)

yields delta=1 since 1hr 59min is truncated to 1 hour. 
sourceraw docstring

esec->Instantclj

(esec->Instant esec)

Wrapper for java.time.Instant/ofEpochSecs

Wrapper for java.time.Instant/ofEpochSecs 
sourceraw docstring

fixed-time-point?clj

(fixed-time-point? it)

Returns true iff arg represents a fixed point in time. Examples:

[java.time ZonedDateTime Instant] [org.joda.time DateTime Instant ReadableInstant]

Returns true iff arg represents a fixed point in time. Examples:

[java.time       ZonedDateTime  Instant]
[org.joda.time        DateTime  Instant  ReadableInstant]
sourceraw docstring

format->iso-strclj

(format->iso-str inst)

Inputs: [inst :- Temporal] Returns: s/Str

Given an Instant or ZonedDateTime, returns a ISO 8601 datetime string like 2018-09-05T23:05:19.123Z

Inputs: [inst :- Temporal]
Returns: s/Str

Given an Instant or ZonedDateTime, returns a ISO 8601 datetime string like `2018-09-05T23:05:19.123Z`
sourceraw docstring

format->iso-str-niceclj

(format->iso-str-nice inst)

Inputs: [inst :- Temporal] Returns: s/Str

Given an Instant or ZonedDateTime, returns an ISO date-time string like 2018-09-05 23:05:19.123Z (with a space instead of T)

Inputs: [inst :- Temporal]
Returns: s/Str

Given an Instant or ZonedDateTime, returns an ISO date-time string like
`2018-09-05 23:05:19.123Z` (with a space instead of `T`)
sourceraw docstring

format->LocalDate-compactclj

(format->LocalDate-compact inst)

Inputs: [inst :- Temporal] Returns: s/Str

Given an Instant or ZonedDateTime, returns a compact date-time string like 2018-09-05 23:05:19.123Z => 20180905

Inputs: [inst :- Temporal]
Returns: s/Str

Given an Instant or ZonedDateTime, returns a compact date-time string like
  `2018-09-05 23:05:19.123Z` => `20180905` 
sourceraw docstring

format->LocalDate-isoclj

(format->LocalDate-iso zdt)

Inputs: [zdt :- Temporal] Returns: s/Str

Given an Instant or ZonedDateTime, returns a string like 2018-09-05

Inputs: [zdt :- Temporal]
Returns: s/Str

Given an Instant or ZonedDateTime, returns a string like `2018-09-05`
sourceraw docstring

format->timestamp-compactclj

(format->timestamp-compact inst)

Inputs: [inst :- Temporal] Returns: s/Str

Given an Instant or ZonedDateTime, returns a compact date-time string like 2018-09-05 23:05:19.123Z => 20180905-230519

Inputs: [inst :- Temporal]
Returns: s/Str

Given an Instant or ZonedDateTime, returns a compact date-time string like
`2018-09-05 23:05:19.123Z` => `20180905-230519` 
sourceraw docstring

Instant?clj

(Instant? it)

Returns true iff arg is an instance of java.time.Instant

Returns true iff arg is an instance of java.time.Instant 
sourceraw docstring

joda-instant?clj

(joda-instant? it)

Returns true iff arg is an instance of org.joda.time.ReadableInstant

Returns true iff arg is an instance of org.joda.time.ReadableInstant 
sourceraw docstring

LocalDate->Dateclj

(LocalDate->Date ld)

Inputs: [ld :- LocalDate] Returns: Date

Converts a LocalDate to a java.util.Date, using midnight (start of day) and the UTC timezone.

Inputs: [ld :- LocalDate]
Returns: Date

Converts a LocalDate to a java.util.Date, using midnight (start of day) and the UTC timezone.
sourceraw docstring

LocalDate->Instantclj

(LocalDate->Instant ld)

Inputs: [ld :- LocalDate] Returns: Instant

Converts a LocalDate to a java.util.Date, using midnight (start of day) and the UTC timezone.

Inputs: [ld :- LocalDate]
Returns: Instant

Converts a LocalDate to a java.util.Date, using midnight (start of day) and the UTC timezone.
sourceraw docstring

LocalDate->tagvalclj

(LocalDate->tagval ld)

Inputs: [ld :- LocalDate] Returns: {:LocalDate s/Str}

Converts a java.time.LocalDate object to a tagval

Inputs: [ld :- LocalDate]
Returns: {:LocalDate s/Str}

Converts a java.time.LocalDate object to a tagval
sourceraw docstring

LocalDate-interval->daysclj

(LocalDate-interval->days interval)

Inputs: [interval :- Interval] Returns: s/Int

Returns the duration in days from the start to the end of a LocalDate Interval

Inputs: [interval :- Interval]
Returns: s/Int

Returns the duration in days from the start to the end of a LocalDate Interval
sourceraw docstring

LocalDate?clj

(LocalDate? arg)

Inputs: [arg] Returns: s/Bool

Returns true iff arg is of type LocalDate

Inputs: [arg]
Returns: s/Bool

Returns true iff arg is of type LocalDate
sourceraw docstring

localdates->day-idxsclj

(localdates->day-idxs ld-vals)

Inputs: [ld-vals :- [LocalDate]] Returns: [s/Int]

Converts a sequence of LocalDate objects into an integer series like [0 1 2 ...], relative to the first value. Assumes LocalDate's are in ascending order.

Inputs: [ld-vals :- [LocalDate]]
Returns: [s/Int]

Converts a sequence of LocalDate objects into an integer series like [0 1 2 ...], relative to the first value.
Assumes LocalDate's are in ascending order.
sourceraw docstring

LocalDateStr?clj

(LocalDateStr? arg)

Inputs: [arg] Returns: s/Bool

Returns true iff string is a legal ISO LocalDate like '1999-12-31' (valid for years 1900-2100).

Inputs: [arg]
Returns: s/Bool

Returns true iff string is a legal ISO LocalDate like '1999-12-31' (valid for years 1900-2100).
sourceraw docstring

millis->Instantclj

(millis->Instant millis)

Wrapper for java.time.Instant/ofEpochMilli

Wrapper for java.time.Instant/ofEpochMilli 
sourceraw docstring

now->Instantclj

(now->Instant)

Returns the current time as a java.lang.Instant

Returns the current time as a java.lang.Instant
sourceraw docstring

now->iso-strclj

(now->iso-str)

Returns an ISO string representation of the current time, like '2019-02-19T18:44:01.123456Z'

Returns an ISO string representation of the current time,
like '2019-02-19T18:44:01.123456Z' 
sourceraw docstring

now->iso-str-simpleclj

(now->iso-str-simple)

Returns a canonical string representation of the current time truncated to the current second, like '2019-02-19 18:44:01Z'

Returns a canonical string representation of the current time truncated to the current second,
like '2019-02-19 18:44:01Z' 
sourceraw docstring

now->ZonedDateTimeclj

(now->ZonedDateTime)

Returns the current time as a java.lang.ZonedDateTime (UTC)

Returns the current time as a java.lang.ZonedDateTime (UTC)
sourceraw docstring

parse-iso-str->Instantclj

(parse-iso-str->Instant iso-datetime-str)

Inputs: [iso-datetime-str :- s/Str] Returns: Instant

Convert an ISO 8601 string to epoch milliseconds. Will collapse excess whitespace.

Inputs: [iso-datetime-str :- s/Str]
Returns: Instant

Convert an ISO 8601 string to epoch milliseconds. Will collapse excess whitespace.
sourceraw docstring

parse-iso-str->millisclj

(parse-iso-str->millis iso-datetime-str)

Inputs: [iso-datetime-str :- s/Str] Returns: s/Int

Convert an ISO 8601 string to epoch milliseconds. Will collapse excess whitespace.

Inputs: [iso-datetime-str :- s/Str]
Returns: s/Int

Convert an ISO 8601 string to epoch milliseconds. Will collapse excess whitespace.
sourceraw docstring

parse-iso-str->sql-timestampclj

(parse-iso-str->sql-timestamp iso-datetime-str)

Inputs: [iso-datetime-str :- s/Str]

Convert an ISO 8601 string to a java.sql.Timestamp

Inputs: [iso-datetime-str :- s/Str]

Convert an ISO 8601 string to a java.sql.Timestamp
sourceraw docstring

parse-iso-str-nice->Instantclj

(parse-iso-str-nice->Instant iso-str)

Inputs: [iso-str :- s/Str] Returns: Instant

Parse a near-iso string like '2019-09-19 18:09:35Z' (it is missing the 'T' between the date & time fields) into an Instant. Will collapse excess whitespace.

Inputs: [iso-str :- s/Str]
Returns: Instant

Parse a near-iso string like '2019-09-19 18:09:35Z' (it is missing the 'T' between the
date & time fields) into an Instant. Will collapse excess whitespace.
sourceraw docstring

parse-sql-timestamp-str->Instant-utcclj

(parse-sql-timestamp-str->Instant-utc sql-timestamp-str)

Inputs: [sql-timestamp-str :- s/Str] Returns: Instant

Parse a near-Timestamp string like ' 2019-09-19 18:09:35 ' (sloppy spacing) into an Instant. Assumes UTC timezone. Will collapse excess whitespace.

Inputs: [sql-timestamp-str :- s/Str]
Returns: Instant

Parse a near-Timestamp string like '  2019-09-19 18:09:35 ' (sloppy spacing) into an Instant.
Assumes UTC timezone. Will collapse excess whitespace.
sourceraw docstring

Period?clj

(Period? it)

Returns true iff arg is an instance of org.joda.time.ReadablePeriod. Example: (period (days 3)) => true

Returns true iff arg is an instance of org.joda.time.ReadablePeriod.
Example:  (period (days 3)) => true 
sourceraw docstring

previous-or-sameclj

(previous-or-same temporal tgt-dow)

Inputs: [temporal :- Temporal tgt-dow :- DayOfWeek] Returns: Temporal

Given a temporal value and a target such as DayOfWeek/SUNDAY, makes the minimal change to previous or same day of week. Example:

  (previous-or-same t DayOfWeek/SUNDAY)
Inputs: [temporal :- Temporal tgt-dow :- DayOfWeek]
Returns: Temporal

Given a temporal value and a target such as DayOfWeek/SUNDAY, makes the minimal
change to previous or same day of week. Example:

      (previous-or-same t DayOfWeek/SUNDAY)
sourceraw docstring

pseudo-Temporalclj

source

rangeclj

(range start-inst stop-inst step-dur)

Inputs: [start-inst :- Temporal stop-inst :- Temporal step-dur :- TemporalAmount] Returns: [Temporal]

Returns a vector of instants in the half-open interval [start stop) (both instants) with increment <step> (a period). Not lazy. Example:

 (range (zoned-date-time 2018 9 1)
        (zoned-date-time 2018 9 5)
        (Duration/ofDays 1)))  => <vector of 4 ZonedDateTime's from 2018-9-1 thru 2018-9-4>
Inputs: [start-inst :- Temporal stop-inst :- Temporal step-dur :- TemporalAmount]
Returns: [Temporal]

Returns a vector of instants in the half-open interval [start stop) (both instants)
with increment <step> (a period). Not lazy.  Example:

     (range (zoned-date-time 2018 9 1)
            (zoned-date-time 2018 9 5)
            (Duration/ofDays 1)))  => <vector of 4 ZonedDateTime's from 2018-9-1 thru 2018-9-4>
sourceraw docstring

same-instant?clj

(same-instant? & temporals)

Inputs: [& temporals :- [pseudo-Temporal]] Returns: s/Bool

Returns true iff two Instant/ZonedDateTime objects (or similar) represent the same instant of time, regardless of time zone. A thin wrapper over ZonedDateTime/isEqual

Inputs: [& temporals :- [pseudo-Temporal]]
Returns: s/Bool

Returns true iff two Instant/ZonedDateTime objects (or similar) represent the same instant of time,
regardless of time zone. A thin wrapper over `ZonedDateTime/isEqual`
sourceraw docstring

stringify-timesclj

(stringify-times form)

Will recursively walk any data structure, converting any fixed-time-point? object to a string

Will recursively walk any data structure, converting any `fixed-time-point?` object to a string
sourceraw docstring

tagval->LocalDateclj

(tagval->LocalDate ldtv)

Inputs: [ldtv :- {:LocalDate s/Str}] Returns: LocalDate

Parses a tagval into a java.time.LocalDate

Inputs: [ldtv :- {:LocalDate s/Str}]
Returns: LocalDate

Parses a tagval into a java.time.LocalDate
sourceraw docstring

Temporal?clj

(Temporal? it)

Returns true iff arg is an instance of java.time.temporal.Temporal

Returns true iff arg is an instance of java.time.temporal.Temporal 
sourceraw docstring

truncated-toclj

(truncated-to temporal chrono-unit)

Inputs: [temporal :- Temporal chrono-unit :- ChronoUnit]

Returns a Temporal truncated to corresponding ChronoUnit. Example:

  (truncated-to t ChronoUnit/HOURS)
Inputs: [temporal :- Temporal chrono-unit :- ChronoUnit]

Returns a Temporal truncated to corresponding ChronoUnit.  Example:

      (truncated-to t ChronoUnit/HOURS)
sourceraw docstring

walk-Instant->sql-Timestampclj

(walk-Instant->sql-Timestamp tree)

Walks a tree-like data structure, converting any instances of java.sql.Timestamp => java.time.Instant

Walks a tree-like data structure, converting any instances of java.sql.Timestamp => java.time.Instant
sourceraw docstring

walk-Instant->strclj

(walk-Instant->str tree)

Walks a tree-like data structure, calling .toString on any instances java.time.Instant

Walks a tree-like data structure, calling `.toString` on any instances java.time.Instant
sourceraw docstring

walk-LocalDate->tagvalclj

(walk-LocalDate->tagval data)
source

walk-sql-Timestamp->Instantclj

(walk-sql-Timestamp->Instant tree)

Walks a tree-like data structure, converting any instances of java.sql.Timestamp => java.time.Instant

Walks a tree-like data structure, converting any instances of java.sql.Timestamp => java.time.Instant
sourceraw docstring

with-zoneidcljmacro

(with-zoneid zone-id & forms)
source

year-quarter?clj

(year-quarter? arg)

Inputs: [arg] Returns: s/Bool

Returns true iff arg is indicates a (financial) quarter in the year.

Inputs: [arg]
Returns: s/Bool

Returns true iff arg is indicates a (financial) quarter in the year.
sourceraw docstring

year-quartersclj

source

zoned-date-timeclj

(zoned-date-time)
(zoned-date-time year)
(zoned-date-time year month)
(zoned-date-time year month day)
(zoned-date-time year month day hour)
(zoned-date-time year month day hour minute)
(zoned-date-time year month day hour minute second)
(zoned-date-time year month day hour minute second nanos)
(zoned-date-time year month day hour minute second nanos zone-id)

Returns a java.time.ZonedDateTime with the specified parameters and truncated values (day/month=1, hour/minute/sec=0) for all other date/time components. Assumes time zone is UTC unless the maximum-arity constructor is used. Usage:

; Assumes UTC time zone (zoned-date-time) => current time (zoned-date-time year) (zoned-date-time year month) (zoned-date-time year month day) (zoned-date-time year month day hour) (zoned-date-time year month day hour minute) (zoned-date-time year month day hour minute second) (zoned-date-time year month day hour minute second nanos)

; Explicit time zone (zoned-date-time year month day hour minute second nanos zone-id)

; Explicit time zone alternate shortcut arities. (with-zoneid zoneid-us-eastern (zoned-date-time year month day ...)) ; any arity w/o zone-id

Returns a java.time.ZonedDateTime with the specified parameters and truncated values (day/month=1, hour/minute/sec=0)
for all other date/time components. Assumes time zone is UTC unless the maximum-arity constructor is used. Usage:

; Assumes UTC time zone
(zoned-date-time)          => current time
(zoned-date-time year)
(zoned-date-time year month)
(zoned-date-time year month day)
(zoned-date-time year month day hour)
(zoned-date-time year month day hour minute)
(zoned-date-time year month day hour minute second)
(zoned-date-time year month day hour minute second nanos)

; Explicit time zone
(zoned-date-time year month day hour minute second nanos zone-id)

; Explicit time zone alternate shortcut arities.
(with-zoneid zoneid-us-eastern
  (zoned-date-time year month day ...))  ; any arity w/o zone-id

sourceraw docstring

ZonedDateTime?clj

(ZonedDateTime? it)

Returns true iff arg is an instance of java.time.ZonedDateTime

Returns true iff arg is an instance of java.time.ZonedDateTime
sourceraw docstring

zoneid-us-alaskaclj

source

zoneid-us-aleutianclj

source

zoneid-us-centralclj

source

zoneid-us-easternclj

source

zoneid-us-hawaiiclj

source

zoneid-us-mountainclj

source

zoneid-us-pacificclj

source

zoneid-utcclj

source

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close