(require '[clj-time.local :as l])
(type (l/to-local-date-time (l/local-now)))
=> org.joda.time.DateTime
but how to get the object by “org.joda.time.LocalDateTime”?
thank you.
(require '[clj-time.local :as l])
(type (l/to-local-date-time (l/local-now)))
=> org.joda.time.DateTime
but how to get the object by “org.joda.time.LocalDateTime”?
thank you.
The issue seems to be described in Please support custom format-local-time formats · Issue #131 · clj-time/clj-time · GitHub
Basically the meaning of ‘local’ in the .local namespace is that those functions handle DateTime objects (with time zones) in the local time zone, while LocalDateTime is timezone-less DateTime.
Not sure if there’s something better than (clj-time.coerce/to-local-date-time (clj-time.core/now))
.
Thank you very much, now I understand.But still have risk of confusion by DateTime and LocalDateTime, so need I unparse the DateTime and parse it again to LocalDateTime for better?
As the primary maintainer of clj-time
, I’ll point out that it is deprecated and no longer maintained – and the README asks folks to either switch to Java Time directly with interop, or use one of two actively maintained alternatives.