Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.joda.time
Class Chronology  view Chronology download Chronology.java

java.lang.Object
  extended byorg.joda.time.Chronology
Direct Known Subclasses:
org.joda.time.chrono.BaseChronology

public abstract class Chronology
extends java.lang.Object

Chronology provides access to the individual date time fields for a chronological calendar system.

Various chronologies are supported by subclasses including ISO and GregorianJulian. This class provides static factory methods to access these chronologies. For example, to obtain the current time in the coptic calendar system:

 DateTime dt = new DateTime(Chronology.getCoptic());
 

The provided chronology implementations are:

Hopefully future releases will contain more chronologies.

This class defines a number of fields with names from the ISO8601 standard. It does not 'strongly' define these fields however, thus implementations are free to interpret the field names as they wish. For example, a week could be defined as 10 days and a month as 40 days in a special WeirdChronology implementation. Clearly the GJ and ISO implementations provided use the field names as you would expect.

Since:
1.0

Constructor Summary
Chronology()
           
 
Method Summary
abstract  long add(long instant, long duration, int scalar)
          Adds the duration to the instant, specifying the number of times to add.
abstract  long add(ReadablePeriod period, long instant, int scalar)
          Adds the period to the instant, specifying the number of times to add.
abstract  DurationField centuries()
          Get the centuries duration field for this chronology.
abstract  DateTimeField centuryOfEra()
          Get the century of era field for this chronology.
abstract  DateTimeField clockhourOfDay()
          Get the hour of day (offset to 1-24) field for this chronology.
abstract  DateTimeField clockhourOfHalfday()
          Get the hour of am/pm (offset to 1-12) field for this chronology.
abstract  DateTimeField dayOfMonth()
          Get the day of month field for this chronology.
abstract  DateTimeField dayOfWeek()
          Get the day of week field for this chronology.
abstract  DateTimeField dayOfYear()
          Get the day of year field for this chronology.
abstract  DurationField days()
          Get the days duration field for this chronology.
abstract  DateTimeField era()
          Get the era field for this chronology.
abstract  DurationField eras()
          Get the eras duration field for this chronology.
abstract  int[] get(ReadablePartial partial, long instant)
          Gets the values of a partial from an instant.
abstract  int[] get(ReadablePeriod period, long duration)
          Gets the values of a period from an interval.
abstract  int[] get(ReadablePeriod period, long startInstant, long endInstant)
          Gets the values of a period from an interval.
static Chronology getBuddhist()
          Gets an instance of the BuddhistChronology in the default zone.
static Chronology getBuddhist(DateTimeZone zone)
          Gets an instance of the BuddhistChronology in the specified zone.
static Chronology getBuddhistUTC()
          Gets an instance of the BuddhistChronology in the UTC zone.
static Chronology getCoptic()
          Gets an instance of the CopticChronology in the default zone.
static Chronology getCoptic(DateTimeZone zone)
          Gets an instance of the CopticChronology in the specified zone.
static Chronology getCopticUTC()
          Gets an instance of the CopticChronology in the UTC zone.
abstract  long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int millisOfDay)
          Returns a datetime millisecond instant, formed from the given year, month, day, and millisecond values.
abstract  long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
          Returns a datetime millisecond instant, formed from the given year, month, day, hour, minute, second, and millisecond values.
abstract  long getDateTimeMillis(long instant, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
          Returns a datetime millisecond instant, from from the given instant, hour, minute, second, and millisecond values.
static Chronology getGJ()
          Gets an instance of the GJChronology in the default zone.
static Chronology getGJ(DateTimeZone zone)
          Gets an instance of the GJChronology in the specified zone.
static Chronology getGJUTC()
          Gets an instance of the GJChronology in the UTC zone.
static Chronology getGregorian()
          Gets an instance of the GregorianChronology in the default zone.
static Chronology getGregorian(DateTimeZone zone)
          Gets an instance of the GregorianChronology in the specified zone.
static Chronology getGregorianUTC()
          Gets an instance of the GregorianChronology in the UTC zone.
static Chronology getISO()
          Gets an instance of the ISOChronology in the default zone.
static Chronology getISO(DateTimeZone zone)
          Gets an instance of the ISOChronology in the specified zone.
static Chronology getISOUTC()
          Gets an instance of the ISOChronology in the UTC zone.
static Chronology getJulian()
          Gets an instance of the JulianChronology in the default zone.
static Chronology getJulian(DateTimeZone zone)
          Gets an instance of the JulianChronology in the specified zone.
static Chronology getJulianUTC()
          Gets an instance of the JulianChronology in the UTC zone.
abstract  DateTimeZone getZone()
          Returns the DateTimeZone that this Chronology operates in, or null if unspecified.
abstract  DateTimeField halfdayOfDay()
          Get the AM(0) PM(1) field for this chronology.
abstract  DurationField halfdays()
          Get the halfdays duration field for this chronology.
abstract  DateTimeField hourOfDay()
          Get the hour of day (0-23) field for this chronology.
abstract  DateTimeField hourOfHalfday()
          Get the hour of am/pm (0-11) field for this chronology.
abstract  DurationField hours()
          Get the hours duration field for this chronology.
abstract  DurationField millis()
          Get the millis duration field for this chronology.
abstract  DateTimeField millisOfDay()
          Get the millis of day field for this chronology.
abstract  DateTimeField millisOfSecond()
          Get the millis of second field for this chronology.
abstract  DateTimeField minuteOfDay()
          Get the minute of day field for this chronology.
abstract  DateTimeField minuteOfHour()
          Get the minute of hour field for this chronology.
abstract  DurationField minutes()
          Get the minutes duration field for this chronology.
abstract  DateTimeField monthOfYear()
          Get the month of year field for this chronology.
abstract  DurationField months()
          Get the months duration field for this chronology.
abstract  DateTimeField secondOfDay()
          Get the second of day field for this chronology.
abstract  DateTimeField secondOfMinute()
          Get the second of minute field for this chronology.
abstract  DurationField seconds()
          Get the seconds duration field for this chronology.
abstract  long set(ReadablePartial partial, long instant)
          Sets the partial into the instant.
abstract  java.lang.String toString()
          Gets a debugging toString.
abstract  void validate(ReadablePartial partial, int[] values)
          Validates whether the values are valid for the fields of a partial instant.
abstract  DateTimeField weekOfWeekyear()
          Get the week of a week based year field for this chronology.
abstract  DurationField weeks()
          Get the weeks duration field for this chronology.
abstract  DateTimeField weekyear()
          Get the year of a week based year field for this chronology.
abstract  DateTimeField weekyearOfCentury()
          Get the year of a week based year in a century field for this chronology.
abstract  DurationField weekyears()
          Get the weekyears duration field for this chronology.
abstract  Chronology withUTC()
          Returns an instance of this Chronology that operates in the UTC time zone.
abstract  Chronology withZone(DateTimeZone zone)
          Returns an instance of this Chronology that operates in any time zone.
abstract  DateTimeField year()
          Get the year field for this chronology.
abstract  DateTimeField yearOfCentury()
          Get the year of century field for this chronology.
abstract  DateTimeField yearOfEra()
          Get the year of era field for this chronology.
abstract  DurationField years()
          Get the years duration field for this chronology.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Chronology

public Chronology()
Method Detail

getISO

public static Chronology getISO()
Gets an instance of the ISOChronology in the default zone.

org.joda.time.chrono.ISOChronology defines all fields in line with the ISO8601 standard. This chronology is the default, and is suitable for all normal datetime processing. It is unsuitable for historical datetimes before October 15, 1582 as it applies the modern Gregorian calendar rules before that date.


getISOUTC

public static Chronology getISOUTC()
Gets an instance of the ISOChronology in the UTC zone.

org.joda.time.chrono.ISOChronology defines all fields in line with the ISO8601 standard. This chronology is the default, and is suitable for all normal datetime processing. It is unsuitable for historical datetimes before October 15, 1582 as it applies the modern Gregorian calendar rules before that date.


getISO

public static Chronology getISO(DateTimeZone zone)
Gets an instance of the ISOChronology in the specified zone.

org.joda.time.chrono.ISOChronology defines all fields in line with the ISO8601 standard. This chronology is the default, and is suitable for all normal datetime processing. It is unsuitable for historical datetimes before October 15, 1582 as it applies the modern Gregorian calendar rules before that date.


getGJ

public static Chronology getGJ()
Gets an instance of the GJChronology in the default zone.

org.joda.time.chrono.GJChronology defines all fields using standard meanings. This chronology is intended to be used as a replacement for GregorianCalendar. The Gregorian calendar system is used after October 15, 1582, while the Julian calendar system is used before.

Unlike GregorianCalendar, this chronology returns a year of -1 for 1 BCE, -2 for 2 BCE and so on. Thus there is no year zero.

This method uses the standard Julian to Gregorian cutover date of October 15th 1582. If you require a cutover on a different date, then use the factories on GJChronology itself.

When dealing solely with dates in the modern era, from 1600 onwards, we recommend using ISOChronology, which is the default.


getGJUTC

public static Chronology getGJUTC()
Gets an instance of the GJChronology in the UTC zone.

org.joda.time.chrono.GJChronology defines all fields using standard meanings. This chronology is intended to be used as a replacement for GregorianCalendar. The Gregorian calendar system is used after October 15, 1582, while the Julian calendar system is used before.

Unlike GregorianCalendar, this chronology returns a year of -1 for 1 BCE, -2 for 2 BCE and so on. Thus there is no year zero.

This method uses the standard Julian to Gregorian cutover date of October 15th 1582. If you require a cutover on a different date, then use the factories on GJChronology itself.

When dealing solely with dates in the modern era, from 1600 onwards, we recommend using ISOChronology, which is the default.


getGJ

public static Chronology getGJ(DateTimeZone zone)
Gets an instance of the GJChronology in the specified zone.

org.joda.time.chrono.GJChronology defines all fields using standard meanings. This chronology is intended to be used as a replacement for GregorianCalendar. The Gregorian calendar system is used after October 15, 1582, while the Julian calendar system is used before.

Unlike GregorianCalendar, this chronology returns a year of -1 for 1 BCE, -2 for 2 BCE and so on. Thus there is no year zero.

This method uses the standard Julian to Gregorian cutover date of October 15th 1582. If you require a cutover on a different date, then use the factories on GJChronology itself.

When dealing solely with dates in the modern era, from 1600 onwards, we recommend using ISOChronology, which is the default.


getGregorian

public static Chronology getGregorian()
Gets an instance of the GregorianChronology in the default zone.

org.joda.time.chrono.GregorianChronology defines all fields using standard meanings. It uses the Gregorian calendar rules for all time (proleptic) thus it is NOT a replacement for GregorianCalendar. For that purpose, you should use getGJ() 55 .

The Gregorian calendar system defines a leap year every four years, except that every 100 years is not leap, but every 400 is leap.

Technically, this chronology is almost identical to the ISO chronology, thus we recommend using ISOChronology instead, which is the default.


getGregorianUTC

public static Chronology getGregorianUTC()
Gets an instance of the GregorianChronology in the UTC zone.

org.joda.time.chrono.GregorianChronology defines all fields using standard meanings. It uses the Gregorian calendar rules for all time (proleptic) thus it is NOT a replacement for GregorianCalendar. For that purpose, you should use getGJ() 55 .

The Gregorian calendar system defines a leap year every four years, except that every 100 years is not leap, but every 400 is leap.

Technically, this chronology is almost identical to the ISO chronology, thus we recommend using ISOChronology instead, which is the default.


getGregorian

public static Chronology getGregorian(DateTimeZone zone)
Gets an instance of the GregorianChronology in the specified zone.

org.joda.time.chrono.GregorianChronology defines all fields using standard meanings. It uses the Gregorian calendar rules for all time (proleptic) thus it is NOT a replacement for GregorianCalendar. For that purpose, you should use getGJ() 55 .

The Gregorian calendar system defines a leap year every four years, except that every 100 years is not leap, but every 400 is leap.

Technically, this chronology is almost identical to the ISO chronology, thus we recommend using ISOChronology instead, which is the default.


getJulian

public static Chronology getJulian()
Gets an instance of the JulianChronology in the default zone.

org.joda.time.chrono.JulianChronology defines all fields using standard meanings. It uses the Julian calendar rules for all time (proleptic). The Julian calendar system defines a leap year every four years.


getJulianUTC

public static Chronology getJulianUTC()
Gets an instance of the JulianChronology in the UTC zone.

org.joda.time.chrono.JulianChronology defines all fields using standard meanings. It uses the Julian calendar rules for all time (proleptic). The Julian calendar system defines a leap year every four years.


getJulian

public static Chronology getJulian(DateTimeZone zone)
Gets an instance of the JulianChronology in the specified zone.

org.joda.time.chrono.JulianChronology defines all fields using standard meanings. It uses the Julian calendar rules for all time (proleptic). The Julian calendar system defines a leap year every four years.


getBuddhist

public static Chronology getBuddhist()
Gets an instance of the BuddhistChronology in the default zone.

org.joda.time.chrono.BuddhistChronology defines all fields using standard meanings, however the year is offset by 543. The chronology cannot be used before year 1 in the Buddhist calendar.


getBuddhistUTC

public static Chronology getBuddhistUTC()
Gets an instance of the BuddhistChronology in the UTC zone.

org.joda.time.chrono.BuddhistChronology defines all fields using standard meanings, however the year is offset by 543. The chronology cannot be used before year 1 in the Buddhist calendar.


getBuddhist

public static Chronology getBuddhist(DateTimeZone zone)
Gets an instance of the BuddhistChronology in the specified zone.

org.joda.time.chrono.BuddhistChronology defines all fields using standard meanings, however the year is offset by 543. The chronology cannot be used before year 1 in the Buddhist calendar.


getCoptic

public static Chronology getCoptic()
Gets an instance of the CopticChronology in the default zone.

org.joda.time.chrono.CopticChronology defines fields sensibly for the Coptic calendar system. The Coptic calendar system defines every fourth year as leap. The year is broken down into 12 months, each 30 days in length. An extra period at the end of the year is either 5 or 6 days in length and is returned as a 13th month. Year 1 in the Coptic calendar began on August 29, 284 CE (Julian). The chronology cannot be used before the first Coptic year.


getCopticUTC

public static Chronology getCopticUTC()
Gets an instance of the CopticChronology in the UTC zone.

org.joda.time.chrono.CopticChronology defines fields sensibly for the Coptic calendar system. The Coptic calendar system defines every fourth year as leap. The year is broken down into 12 months, each 30 days in length. An extra period at the end of the year is either 5 or 6 days in length and is returned as a 13th month. Year 1 in the Coptic calendar began on August 29, 284 CE (Julian). The chronology cannot be used before the first Coptic year.


getCoptic

public static Chronology getCoptic(DateTimeZone zone)
Gets an instance of the CopticChronology in the specified zone.

org.joda.time.chrono.CopticChronology defines fields sensibly for the Coptic calendar system. The Coptic calendar system defines every fourth year as leap. The year is broken down into 12 months, each 30 days in length. An extra period at the end of the year is either 5 or 6 days in length and is returned as a 13th month. Year 1 in the Coptic calendar began on August 29, 284 CE (Julian). The chronology cannot be used before the first Coptic year.


getZone

public abstract DateTimeZone getZone()
Returns the DateTimeZone that this Chronology operates in, or null if unspecified.


withUTC

public abstract Chronology withUTC()
Returns an instance of this Chronology that operates in the UTC time zone. Chronologies that do not operate in a time zone or are already UTC must return themself.


withZone

public abstract Chronology withZone(DateTimeZone zone)
Returns an instance of this Chronology that operates in any time zone.


getDateTimeMillis

public abstract long getDateTimeMillis(int year,
                                       int monthOfYear,
                                       int dayOfMonth,
                                       int millisOfDay)
Returns a datetime millisecond instant, formed from the given year, month, day, and millisecond values. The set of given values must refer to a valid datetime, or else an IllegalArgumentException is thrown.

The default implementation calls upon separate DateTimeFields to determine the result. Subclasses are encouraged to provide a more efficient implementation.


getDateTimeMillis

public abstract long getDateTimeMillis(int year,
                                       int monthOfYear,
                                       int dayOfMonth,
                                       int hourOfDay,
                                       int minuteOfHour,
                                       int secondOfMinute,
                                       int millisOfSecond)
Returns a datetime millisecond instant, formed from the given year, month, day, hour, minute, second, and millisecond values. The set of given values must refer to a valid datetime, or else an IllegalArgumentException is thrown.

The default implementation calls upon separate DateTimeFields to determine the result. Subclasses are encouraged to provide a more efficient implementation.


getDateTimeMillis

public abstract long getDateTimeMillis(long instant,
                                       int hourOfDay,
                                       int minuteOfHour,
                                       int secondOfMinute,
                                       int millisOfSecond)
Returns a datetime millisecond instant, from from the given instant, hour, minute, second, and millisecond values. The set of given values must refer to a valid datetime, or else an IllegalArgumentException is thrown.

The default implementation calls upon separate DateTimeFields to determine the result. Subclasses are encouraged to provide a more efficient implementation.


validate

public abstract void validate(ReadablePartial partial,
                              int[] values)
Validates whether the values are valid for the fields of a partial instant.


get

public abstract int[] get(ReadablePartial partial,
                          long instant)
Gets the values of a partial from an instant.


set

public abstract long set(ReadablePartial partial,
                         long instant)
Sets the partial into the instant.


get

public abstract int[] get(ReadablePeriod period,
                          long startInstant,
                          long endInstant)
Gets the values of a period from an interval.


get

public abstract int[] get(ReadablePeriod period,
                          long duration)
Gets the values of a period from an interval.


add

public abstract long add(ReadablePeriod period,
                         long instant,
                         int scalar)
Adds the period to the instant, specifying the number of times to add.


add

public abstract long add(long instant,
                         long duration,
                         int scalar)
Adds the duration to the instant, specifying the number of times to add.


millis

public abstract DurationField millis()
Get the millis duration field for this chronology.


millisOfSecond

public abstract DateTimeField millisOfSecond()
Get the millis of second field for this chronology.


millisOfDay

public abstract DateTimeField millisOfDay()
Get the millis of day field for this chronology.


seconds

public abstract DurationField seconds()
Get the seconds duration field for this chronology.


secondOfMinute

public abstract DateTimeField secondOfMinute()
Get the second of minute field for this chronology.


secondOfDay

public abstract DateTimeField secondOfDay()
Get the second of day field for this chronology.


minutes

public abstract DurationField minutes()
Get the minutes duration field for this chronology.


minuteOfHour

public abstract DateTimeField minuteOfHour()
Get the minute of hour field for this chronology.


minuteOfDay

public abstract DateTimeField minuteOfDay()
Get the minute of day field for this chronology.


hours

public abstract DurationField hours()
Get the hours duration field for this chronology.


hourOfDay

public abstract DateTimeField hourOfDay()
Get the hour of day (0-23) field for this chronology.


clockhourOfDay

public abstract DateTimeField clockhourOfDay()
Get the hour of day (offset to 1-24) field for this chronology.


halfdays

public abstract DurationField halfdays()
Get the halfdays duration field for this chronology.


hourOfHalfday

public abstract DateTimeField hourOfHalfday()
Get the hour of am/pm (0-11) field for this chronology.


clockhourOfHalfday

public abstract DateTimeField clockhourOfHalfday()
Get the hour of am/pm (offset to 1-12) field for this chronology.


halfdayOfDay

public abstract DateTimeField halfdayOfDay()
Get the AM(0) PM(1) field for this chronology.


days

public abstract DurationField days()
Get the days duration field for this chronology.


dayOfWeek

public abstract DateTimeField dayOfWeek()
Get the day of week field for this chronology.

DayOfWeek values are defined in DateTimeConstants. They use the ISO definitions, where 1 is Monday and 7 is Sunday.


dayOfMonth

public abstract DateTimeField dayOfMonth()
Get the day of month field for this chronology.


dayOfYear

public abstract DateTimeField dayOfYear()
Get the day of year field for this chronology.


weeks

public abstract DurationField weeks()
Get the weeks duration field for this chronology.


weekOfWeekyear

public abstract DateTimeField weekOfWeekyear()
Get the week of a week based year field for this chronology.


weekyears

public abstract DurationField weekyears()
Get the weekyears duration field for this chronology.


weekyear

public abstract DateTimeField weekyear()
Get the year of a week based year field for this chronology.


weekyearOfCentury

public abstract DateTimeField weekyearOfCentury()
Get the year of a week based year in a century field for this chronology.


months

public abstract DurationField months()
Get the months duration field for this chronology.


monthOfYear

public abstract DateTimeField monthOfYear()
Get the month of year field for this chronology.


years

public abstract DurationField years()
Get the years duration field for this chronology.


year

public abstract DateTimeField year()
Get the year field for this chronology.


yearOfEra

public abstract DateTimeField yearOfEra()
Get the year of era field for this chronology.


yearOfCentury

public abstract DateTimeField yearOfCentury()
Get the year of century field for this chronology.


centuries

public abstract DurationField centuries()
Get the centuries duration field for this chronology.


centuryOfEra

public abstract DateTimeField centuryOfEra()
Get the century of era field for this chronology.


eras

public abstract DurationField eras()
Get the eras duration field for this chronology.


era

public abstract DateTimeField era()
Get the era field for this chronology.


toString

public abstract java.lang.String toString()
Gets a debugging toString.