Google表单为我提供了此功能:
"02/12/2014 10:44:36"
使用clojure将其转换为edn时间格式的好方法是什么?
;=> #inst "2014-12-02T10:44:36.000-00:00"
谢谢!
更新:
GForm给了我0到23的时间。因此,答案应该适用于此:
"02/12/2014 15:44:36"
谢谢!
您可以使用clj-time
:
(require '[clj-time.coerce :as c]
'[clj-time.format :as f])
(def custom-formatter (f/formatter "dd/MM/yyyy hh:mm:ss"))
(pr-str
(c/to-date
(f/parse custom-formatter "02/12/2014 10:44:36")))
; => "#inst \"2014-12-02T10:44:36.000-00:00\""
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句