我正在尝试将时间以秒为单位转换为带有时区的时间戳。
我试过了
(defn- seconds-to-milliseconds[time]
(* time 1000))
(:require [clj-time.coerce :as clj-time])
(clj-time/from-long (seconds-to-milliseconds 1564132000))
结果是:#clj-time/date-time"2019-07-26T09:06:40.000Z"
但是这个结果我不能存储在 Postgres 数据库中,因为我得到了
PSQLException: Can't infer the SQL type to use for an instance of org.joda.time.DateTime. Use setObject() with an explicit Types value to specify the type to use
所以我需要转换它
(clj-time/to-timestamp (clj-time/from-long (seconds-to-milliseconds 1564132000))))
结果是
#inst"2019-07-26T09:06:40.000000000-00:00"
我可以将其存储在 postgres 中,但它没有时区。
谁能帮我将时间以秒为单位转换为带有时区的时间戳。