Modern Java in Action 6 - Time and Date
Reasons to abandon old API
java.util.Date
- mutable
- unintuitive constructor (days, months, minutes and seconds are 0-based, year represented as delta from 1900), values wrap-around
- cannot be internationalized
java.util.Calendar
- not thread safe
- mutable (no clear semantics date change)
- when to use which?
java.util.DateFormat
- not thead-safe
- can only parse
Date, notCalendar
New API

java.time package
Classes and interfaces in a new package java.time (modelled after Joda Time classes) provide better way of thinking about and working with time concepts.
The most important classess in this package are: LocalDate, LocalTime, LocalDateTime, Instant, Duration, and Period .









