Skip to content
Snippets Groups Projects
Commit f78659b8 authored by Cam Saul's avatar Cam Saul
Browse files

use milliseconds in date stuff

parent 7dfc7956
Branches
Tags
No related merge requests found
......@@ -84,17 +84,14 @@
(Some DBs like Postgres will get snippy if you don't use a `java.sql.Timestamp`)."
[]
(-> (java.util.Date.)
.getTime ; time in milliseconds
(/ 1000) ; we don't care about the ms so strip them out
int
(* 1000)
.getTime
(java.sql.Timestamp.)))
(defn parse-iso8601
"parse a string value expected in the iso8601 format into a `java.sql.Date`."
[datetime]
(some->> datetime
(time/parse (time/formatters :date-time-no-ms))
(time/parse (time/formatters :date-time))
(coerce/to-long)
(java.sql.Date.)))
......@@ -102,7 +99,7 @@
(defn now-iso8601
"format the current time as iso8601 date/time string."
[]
(time/unparse (time/formatters :date-time-no-ms) (coerce/from-long (System/currentTimeMillis))))
(time/unparse (time/formatters :date-time) (coerce/from-long (System/currentTimeMillis))))
(defn jdbc-clob-to-str
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment