scala-time is a simple Scala wrapper for easier use JDK 1.8.0 (Java 8) time APIs
Overview
The library is contained in the scalatime which includes type aliases, as well as
factory objects for core java.time types and constant values.
It is further divided into packages corresponding to the underlying
java.time package - with the exception of
the syntax package which includes additional implicit conversion functions as well as
methods for easier use of the underlying java types; and the control package
which provides default scala.util.control.Exception.Catcher instances for exceptions which may be thrown by the
underlying library, and type aliases for those exceptions.
Package Structure
temporal - Access to date and time using fields and units, and date time adjusters.
chrono - Generic API for calendar systems other than the default ISO.
format - Provides classes to print and parse dates and times.
syntax - Implicit functions, and methods for easier use of time APIs.
Example:
// Import the required classes path:import codes.reactive.scalatime._
import syntax._
// Obtain a Duration instance from a Longval duration = 10L minutes
val otherDuration = 1L minute
// Tries to obtain a Period instance from an Intval period = 2 weeks
// Obtain a LocalDate instanceval localDate = LocalDate.of(2014, 6, 7)
// Obtain the current UTC ZonedDateTimeval zonedDateTime = ZonedDateTime()
// Obtain a default TemporalQuery for the ZoneIdval query = temporal.TemporalQuery.zone
// Obtain a Duration instance from a sum of Durations
duration + otherDuration
// Add a TemporalAmount to a Temporal
localDate.get + period
// Add a TemporalAmount to a Temporal
period <<+ localDate.get
// Subtract a TemporalAmount from a Temporal
localDate.get - period
// Query a specified Temporalval result = query << zonedDateTime
Scala Time
scala-time is a simple Scala wrapper for easier use JDK 1.8.0 (Java 8) time APIs
Overview
The library is contained in the scalatime which includes type aliases, as well as factory objects for core java.time types and constant values.
It is further divided into packages corresponding to the underlying java.time package - with the exception of the syntax package which includes additional implicit conversion functions as well as methods for easier use of the underlying java types; and the control package which provides default scala.util.control.Exception.Catcher instances for exceptions which may be thrown by the underlying library, and type aliases for those exceptions.
Package Structure