This Article introduces Java Temporal Objects

  • TemporalAccessor Framework-level interface defining read-only access to a temporal object

  • Temporal Framework-level interface definning read-write access to a Temporal object

  • TemporalQuery Strategy for querying a temporal object

  • Chronology A calender system, used to organize and identify dates,such as Japanese, minguo. The main date and time API is built on the iso calender system.

  • ChronoLocalDate A date interface without time-of-day or time-zone in an arbitary chronology

  • ChronoZonedDateTime a date-time with time-zone in an arbitary chronology.

  • LocalDate A date without a time-zone in the ISO-8601 calendar system, such as 2007-12-0

  • Instant An instaneous point on the time-line, the class stores a long representing epoch-seconds and an int representing nanosecond-of-second

  • ZonedDateTime A date-time with time-zone in the ISO-8601 calender system


interface TemporalAccessor {
    int get(TemporalField field)
    R query(TemporalQuery<R> query)
}
interface Temporal extends TemporalAccessor {
    Temporal plus(TemporalAmount amount)
    Temporal minus(TemporalAmount amount)
    Temporal with(TemporalAdjuster adjuster)
}

interface ChronoLocalDate extends Temporal, TemporalAdjuster {
    Chronology getChronology()
}

interface TemporalQuery<R> {
    R queryFrom(TemporalAccessor temporal)
}

interface ChronoZonedDateTime extends Temporal {
    ZoneId getZone()
    ChronoLocalDateTime<D> toLocalDateTime()
}

class LocalDate implements Temporal, TemporalAdjuster, ChronoLocalDate {
    int year
    short month
    short day
}

class LocalTime implements Temporal, TemporalAdjuster {
    byte hour
    byte minute
    byte second
    int nano
}

class Instant implements Temporal, TemporalAdjuster {
    long seconds
    int nanos
}

class LocalDateTime implements Temporal, TemporalAdjuster, ChronoLocalDateTime {
    LocalDate date
    LocalTime time
}

class ZonedDateTime implements Temporal, ChronoZonedDateTime {
    LocalDateTime dateTime
    ZoneOffset offset
    ZoneId zone
}


LocalDateTime o-up- LocalDate
LocalDateTime o-up- LocalTime
ZonedDateTime o-up- LocalDateTime