Liking cljdoc? Tell your friends :D

std.time.format


+format-cache+clj


+parse-cache+clj


cacheclj

(cache cache constructor ks flag)

helper function to access formatters by keyword

(f/cache f/+format-cache+ nil [java.text.SimpleDateFormat "HH MM dd Z"] true)

helper function to access formatters by keyword

(f/cache f/+format-cache+
         nil
        [java.text.SimpleDateFormat "HH MM dd Z"]
         true)
raw docstring

formatclj

(format t pattern)
(format t pattern {:keys [cached] :as opts})

converts a date into a string

(f/format (Date. 0) "HH MM dd Z" {:timezone "GMT" :cached true}) => "00 01 01 +0000"

(f/format (common/calendar (Date. 0) (TimeZone/getTimeZone "GMT")) "HH MM dd Z" {}) => "00 01 01 +0000"

(f/format (Timestamp. 0) "HH MM dd Z" {:timezone "PST"}) => "16 12 31 -0800"

(f/format (Date. 0) "HH MM dd Z") => string?

converts a date into a string

(f/format (Date. 0) "HH MM dd Z" {:timezone "GMT" :cached true})
=> "00 01 01 +0000"

(f/format (common/calendar (Date. 0)
                           (TimeZone/getTimeZone "GMT"))
          "HH MM dd Z"
          {})
=> "00 01 01 +0000"

(f/format (Timestamp. 0)
          "HH MM dd Z"
          {:timezone "PST"})
=> "16 12 31 -0800"

(f/format (Date. 0) "HH MM dd Z")
=> string?
raw docstring

parseclj

(parse s pattern)
(parse s pattern {:keys [cached] :as opts})

testing format for java.time datastructures (-> (f/parse "00 00 01 01 01 1989 +0000" "ss mm HH dd MM yyyy Z" {:type Clock}) (map/to-map {} common/+default-keys+)) => {:type java.time.Clock$FixedClock, :timezone "Etc/GMT" :long 599619600000, :year 1989, :month 1, :day 1, :hour 1, :minute 0, :second 0, :millisecond 0}

(-> (f/parse "00 00 01 01 01 1989 -1000" "ss mm HH dd MM yyyy Z" {:type Clock}) (map/to-map {} common/+default-keys+)) => {:type java.time.Clock$FixedClock, :timezone "Etc/GMT-10", :long 599583600000, :year 1989, :month 1, :day 1, :hour 1, :minute 0, :second 0, :millisecond 0}

(-> (f/parse "00 00 01 01 01 1989 +1000" "ss mm HH dd MM yyyy Z" {:type Clock}) (map/to-map {} common/+default-keys+)) => {:type java.time.Clock$FixedClock, :timezone "Etc/GMT+10", :long 599655600000, :year 1989, :month 1, :day 1, :hour 1, :minute 0, :second 0, :millisecond 0}

testing format for java.time datastructures
(-> (f/parse "00 00 01 01 01 1989 +0000" "ss mm HH dd MM yyyy Z"
             {:type Clock})
    (map/to-map {} common/+default-keys+))
=> {:type java.time.Clock$FixedClock,
    :timezone "Etc/GMT"
    :long 599619600000,
    :year 1989, :month 1, :day 1,
    :hour 1, :minute 0, :second 0, :millisecond 0}

(-> (f/parse "00 00 01 01 01 1989 -1000" "ss mm HH dd MM yyyy Z"
             {:type Clock})
    (map/to-map {} common/+default-keys+))
=> {:type java.time.Clock$FixedClock, :timezone "Etc/GMT-10", :long 599583600000,
    :year 1989, :month 1, :day 1, :hour 1, :minute 0, :second 0, :millisecond 0}

(-> (f/parse "00 00 01 01 01 1989 +1000" "ss mm HH dd MM yyyy Z"
             {:type Clock})
    (map/to-map {} common/+default-keys+))
=> {:type java.time.Clock$FixedClock, :timezone "Etc/GMT+10", :long 599655600000,
    :year 1989, :month 1, :day 1, :hour 1, :minute 0, :second 0, :millisecond 0}
raw docstring

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

× close