(t/instant? (.toInstant #inst "2020-09-26T23:08:27.619-00:00"))
=> true
(t/instant? (t/instant #inst "2020-09-26T23:08:27.619-00:00"))
=> true
This works: (t/format "<http://yyyy.MM|yyyy.MM>.dd" (t/zoned-date-time 2015 9 28))
=> "2015.09.28"
but I can't find a way to convert a datomic db.type/instant to a zoned-date-time.
There must be a more straightforward way to format datomic datetime values.
user=> (t/format "dd/MM/yyyy" (t/zoned-date-time #inst "2020-09-26T23:08:27.619-00:00" (t/zone-id "UTC")))
"26/09/2020"
user=>
(or whatever TZ you need there)
Although if you're dealing with #inst
which I believe are just regular java.util.Date
objects, this should work (without clojure.java-time
at all):
user=> (let [f (java.text.SimpleDateFormat. "dd/MM/yyyy")]
(.format f #inst "2020-09-26T23:08:27.619-00:00"))
"26/09/2020"
user=>
Yup, Datomic docs say it's just a java.util.Date
:
:db.type/instant instant in time java.util.Date #inst "2017-09-16T11:43:32.450-00:00"