JSR-310

JSR-310 defines a new Date and Time API for Java. The API describes the two basic forms of time - continuous and human.

Continuous time is designed for machines, and runs on a single incrementing number. This is often associated with the result from System.currentTimeMillis().

The main class for representing continuous time is Instant. It uses nanosecond precision and can support a range greater than the age of the universe.

Human time is designed for humans, and is based around meaningful fields. Examples of the fields include year, month of year, quarter of year and hour of day.

The most basic classes representing human time are LocalDate, LocalTime and LocalDateTime. These represent dates and times without any offset from UTC or time zone.

The next level of classes add the offset from UTC, such as "+01:00" - OffsetDate, OffsetTime and OffsetDateTime. These still do not contain time zone information, just the offset.

The final level adds the time zone, such as "Europe/London" - ZonedDateTime.

In combination, these seven classes represent the possible combinations of valid date and time information. Furthermore, these classes can only ever be in a valid state. They are also immutable.

These classes, and the whole of the main API, is specific to the ISO calendar system. This is the de facto world calendar following the proleptic Gregorian rules. The i18n package contains other calendar systems.