add local timestamp conversion function

This commit is contained in:
Gered 2014-07-08 10:05:22 -04:00
parent f06b612dcc
commit fd465f3466

View file

@ -8,6 +8,7 @@
(def tz (TimeZone/getDefault)) (def tz (TimeZone/getDefault))
(def iso8601-timestamp "yyyy-MM-dd'T'HH:mm:ssXXX") (def iso8601-timestamp "yyyy-MM-dd'T'HH:mm:ssXXX")
(def iso8601-local-timestamp "yyyy-MM-dd'T'HH:mm:ss")
(def iso8601-date "yyyy-MM-dd") (def iso8601-date "yyyy-MM-dd")
(defn format-date [^Date date ^String format] (defn format-date [^Date date ^String format]
@ -21,6 +22,13 @@
[^Date date] [^Date date]
(format-date date iso8601-timestamp)) (format-date date iso8601-timestamp))
(defn ->iso-local-timestamp
"returns an ISO8601 formatted date/time string for the given date object. the timestamp
will not include any timezone information and so is appropriate for local timezone
date/times only."
[^Date date]
(format-date date iso8601-timestamp))
(defn ->iso-date (defn ->iso-date
"returns an ISO8601 formatted date string for the given date object" "returns an ISO8601 formatted date string for the given date object"
[^Date date] [^Date date]