Github:https://github.com/nscala-time/nscala-time
MAVEN: (Pay attention to the Scala version)
<Dependency> <groupId>Com.github.nscala-time</groupId> <Artifactid>nscala-time_2.10</Artifactid> <version>2.6.0</version></Dependency>
code example:
Remember import com.github.nscala_time.time.imports._
scala> DateTime.Parse ("20150101", DateTimeFormat forpattern ("YyyyMMdd"))
Res11:org.joda.time.DateTime = 2015-01-01t00:00:00.000+08:00
scala> DateTime.Parse ("2015-01-01")
Res12:org.joda.time.DateTime = 2015-01-01t00:00:00.000+08:00
scala> DateTime.Parse ("2015-01-01t08:23:56")
Res13:org.joda.time.DateTime = 2015-01-01t08:23:56.000+08:00
scala> DateTime.Now + 2.months
Res14:org.joda.time.DateTime = 2016-03-20t17:46:31.288+08:00
scala> Datetime.nextmonth < DateTime.Now + 2.month
Res15:boolean = True
scala> DateTime.Now to Datetime.tomorrow
Res16:org.joda.time.Interval = 2016-01-20t17:46:31.743+08:00/2016-01-21t17:46:31.743+08:00
scala> (DateTime.Now to Datetime.nextsecond). Millis
Res17:long = 1000
scala> 2.hours + 45.minutes + 10.seconds
Res18:com.github.nscala_time.time.DurationBuilder = [email protected]
scala> (2.hours + 45.minutes + 10.seconds). Millis
Res19:long = 9910000
scala> 2.months + 3.days
Res20:org.joda.time.Period = P2m3d
scala> DateTime.now.hour (2). minute. Second (10)
Res21:org.joda.time.DateTime = 2016-01-20t02:45:10.762+08:00
Scala-processing time (Nscala-time-joda in Scala package)