Return to Snippet

Revision: 54385
at December 21, 2011 23:10 by ef


Initial Code
(defn- get-current-iso-8601-date
  "Returns current ISO 8601 compliant date."
  []
  (let [current-date-time (time/to-time-zone (time/now) (time/default-time-zone))]
    (time-format/unparse
     (time-format/with-zone (time-format/formatters :date-time-no-ms) 
                            (.getZone current-date-time))
     current-date-time)))

Initial URL


Initial Description
Better way of generating date in ISO 8601 format (e.g. "2011-12-12T20:50:22+0100").  
Needs to require  [clj-time.core :as time]  and  [clj-time.format :as time-format].

Initial Title
Clojure ISO 8601 current date with clj-time

Initial Tags
date

Initial Language
Clojure