Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
100 views
in Technique[技术] by (71.8m points)

java - What is the best way to get date and time in Clojure?

I need to log some events on a Clojure Client-Server scenario, but it seems to me that Clojure does not provide a date/time function. Can any one confirm this or I am missing something here?! If I am correct then I need to use java interop, right?

question from:https://stackoverflow.com/questions/4635680/what-is-the-best-way-to-get-date-and-time-in-clojure

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

If all you need is to get the current time and date for your logger, then this function is OK:

 (defn now [] (new java.util.Date))

Now that you mentioned this, it would be useful to have support for immutable Date objects.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...