Gregorian calendar system

The Gregorian calendar system is calendar system used by most of the modern business world. It was first introduced on 1582-10-15 replacing the Julian calendar. Gregorian rules define a leap year as once every four years, except every 100, but including every 400.

The Gregorian chronology in Joda-Time is equivalent* to the ISO chronology, and uses Gregorian rules for all time. Thus it is not historically accurate before 1583. This also means that the Gregorian chronology does not correspond to the java class GregorianCalendar. See GregorianJulian for a suitable replacement.

* The Gregorian and ISO chronologies do in fact differ slightly. The Gregorian chronology defines a century as it is spoken, thus 2005 is in the 21st century. The ISO chronology defines a century as the first two digits of the year, thus 2005 has a century field of 20.


Using Gregorian chronology in Joda-Time

Within Joda-Time the Gregorian calendar system can be used by obtaining an instance of GregorianChronology. This is normally created using the factory method GregorianChronology.getInstance(). This is then passed into the constructors of the main date and time classes.

// setup date object for midday on Christmas 2004
Chronology chrono = GregorianChronology.getInstance();
DateTime dt = new DateTime(2004, 12, 25, 12, 0, 0, 0, chrono);

Back to top

Version: 2.12.7. Last Published: 2024-04-15.

Reflow Maven skin.