Java Reference
In-Depth Information
Table 6-4. New Date/Time API: Human time
Description
Class
Connects to the low-level API
Calendrical
DateTimeFields Stores a map of field-value pairs, which are not required to be consistent
A day of the week (e.g., Tuesday)
DayOfWeek
A bare date (day, month, and year) with no adjustments
LocalDate
A bare time (hour, minute, seconds) with no adjustments
LocalTime
The combination of the above
LocalDateTime
Month and day
MonthDay
A time of day with a time zone offset like -04:00, with no date or zone
OffsetTime
OffsetDateTime A date and time with a time zone offset like -04:00 with no time zone
A descriptive amount of time, such as “2 months and 3 days”
Period
The date and time with a time zone and an offset
ZonedDateTime
A year by itself
Year
A year and month
YearMonth
Almost all the top-level classes directly extend java.lang.Object and are held to consist-
ency by a variety of interfaces, which are declared in the subpackages. The date and time
classes mostly implement Comparable , which makes sense.
Table 6-5 shows the two time zone-specific classes, used with ZonedDateTime , Off-
setDateTime , and OffsetTime .
Search WWH ::




Custom Search