@NonNullByDefault
Package java.time.chrono
Generic API for calendar systems other than the default ISO.
The main API is based around the calendar system defined in ISO-8601.
However, there are other calendar systems, and this package provides basic support for them.
The alternate calendars are provided in the java.time.chrono package.
A calendar system is defined by the Chronology interface,
while a date in a calendar system is defined by the ChronoLocalDate interface.
It is intended that applications use the main API whenever possible, including code to read and write
from a persistent data store, such as a database, and to send dates and times across a network.
The "chrono" classes are then used at the user interface level to deal with localized input/output.
See ChronoLocalDate
for a full discussion of the issues.
Using non-ISO calendar systems in an application introduces significant extra complexity.
Ensure that the warnings and recommendations in ChronoLocalDate have been read before
working with the "chrono" interfaces.
Example
This example lists todays date for all of the available calendars.
// Enumerate the list of available calendars and print todays date for each.
Set<Chronology> chronos = AbstractChronology.getAvailableChronologies();
for (Chronology chrono : chronos) {
ChronoLocalDate date = chrono.dateNow();
System.out.printf(" %20s: %s%n", chrono.getId(), date.toString());
}
Package specification
The Javadoc "@param" definition is used to summarise the null-behavior.
since JDK1.8-
Interface Summary Interface Description ChronoLocalDate A date without time-of-day or time-zone in an arbitrary chronology, intended for advanced globalization use cases.ChronoLocalDateTime<D extends ChronoLocalDate> A date-time without a time-zone in an arbitrary chronology, intended for advanced globalization use cases.Chronology A calendar system, used to organize and identify dates.ChronoPeriod A date-based amount of time, such as '3 years, 4 months and 5 days' in an arbitrary chronology, intended for advanced globalization use cases.ChronoZonedDateTime<D extends ChronoLocalDate> A date-time with a time-zone in an arbitrary chronology, intended for advanced globalization use cases.Era An era of the time-line. -
Class Summary Class Description AbstractChronology An abstract implementation of a calendar system, used to organize and identify dates.IsoChronology The ISO calendar system. -
Enum Summary Enum Description IsoEra An era in the ISO calendar system.