add local timestamp conversion function
This commit is contained in:
parent
f06b612dcc
commit
fd465f3466
|
@ -8,6 +8,7 @@
|
|||
|
||||
(def tz (TimeZone/getDefault))
|
||||
(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")
|
||||
|
||||
(defn format-date [^Date date ^String format]
|
||||
|
@ -21,6 +22,13 @@
|
|||
[^Date date]
|
||||
(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
|
||||
"returns an ISO8601 formatted date string for the given date object"
|
||||
[^Date date]
|
||||
|
|
Reference in a new issue