/ Published in: Clojure

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].
Needs to require [clj-time.core :as time] and [clj-time.format :as time-format].
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
(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)))
Comments
