Java - Human-Scale Time


Humans deal with time in terms of fields such as year, month, day, hour, minute, and second.

The following format is used to specify date and time in ISO-8601 format:

[date]T[time][zone offset]

The Date-Time API provides several classes listed in the following table to represent all fields and their combinations of human-scale time.

Class Name Date Time Zone Offset Zone Rule
LocalDate YesNo No No
LocalTimeNoYesNo No
LocalDateTime YesYesNo No
OffsetTime NoYesYes No
OffsetDateTime YesYesYes No
ZonedDateTime YesYesYes Yes
ZoneOffset NoNo Yes No
ZoneId NoNo Yes Yes