从其他时间类型添加 joda 日期时间
clj-time.coerce 库可以帮助将其他日期时间格式转换为 joda 时间格式(clj-time.core / date-time)。其他格式包括 Java 长格式,字符串,日期, SQL 日期。
要从其他时间格式转换时间,请包含库并使用 from-function,例如
(require '[clj-time.coerce :as c])
(def string-time "1990-01-29")
(def epoch-time 633571200)
(def long-time 633551400)
(c/from-string string-time) ;; #<DateTime 1990-01-29T00:00:00.000Z>
(c/from-epoch epoch-time) ;; #<DateTime 1990-01-29T00:00:00.000Z>
(c/from-long 633551400) ;; #<DateTime 1990-01-29T00:00:00.000Z>