Ben Chuanlong Du's Blog

It is never too late to learn.

Date and Time in Java and Scala

Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!

Use Joda time if you are using JDK <= 7 and java.time if you are using JDK8 and above.

If you do prefer Scala libraries (when working in Scala), https://github.com/nscala-time/nscala-time wrapper of Joda time

libraryDependencies += "com.github.nscala-time" %% "nscala-time" % "2.16.0"

https://github.com/reactivecodes/scala-time wrapper of java.time

// Requires JDK 1.8 and above
"codes.reactive" %% "scala-time" % "0.4.1"

Comments