What is the right way to parse Clojure time instants like #inst "2017-01-01T12:00:00"
to Joda time using the clj-time library?
If you have a java.util.Date
object:
(type #inst "2017-01-01T12:00:00+02:00")
;;=> java.util.Date
clj-time
has a clj-time.coerce
namespace with a from-date
function that takes java.util.Date
objects as input. Example:
(require '[clj-time.coerce :as c])
((juxt type str) (c/from-date #inst "2017-01-01T12:00:00"))
;;=> [org.joda.time.DateTime "2017-01-01T12:00:00.000Z"]