Joda Time API

org.joda.time.gj
Class GJChronology

java.lang.Object
  |
  +--org.joda.time.Chronology
        |
        +--org.joda.time.gj.GJChronology
All Implemented Interfaces:
java.io.Serializable

public abstract class GJChronology
extends Chronology

GJChronology provides access to the individual date time fields for the GregorianJulian defined chronological calendar system.

The point in time when that chronology switches can be controlled using setGregorianJulianCutover(). By default this is set to the date the Gregorian calendar was first instituted, October 15, 1582.

Before this date, this chronology uses the proleptic Julian calendar (Proleptic means extending indefinitely). The Julian calendar has leap years every four years, whereas the Gregorian has special rules for 100 and 400 years. A meaningful result will thus be obtained for all input values. However before March 1, 4 CE, Julian leap years were irregular, and before 45 BCE there was no Julian calendar.

This chronology differs from GregorianCalendar in that years in BCE are returned correctly. Thus 1 BCE is returned as -1.

Author:
Stephen Colebourne, Brian S O'Neill
See Also:
Serialized Form

Method Summary
 DateTimeField amPmOfDay()
          Get the AM (0) PM(1) field for this chronology.
 DateTimeField dayOfMonth()
          Get the day of month field for this chronology.
 DateTimeField dayOfWeek()
          Get the day of week field for this chronology.
 DateTimeField dayOfYear()
          Get the day of year field for this chronology.
 DateTimeField era()
          Get the era field for this chronology.
 long getDateOnlyMillis(long millis)
          Get the millis for a date only field.
 DateTimeZone getDateTimeZone()
          Returns the DateTimeZone that this Chronology operates in, or null if unspecified.
 Instant getGregorianJulianCutover()
          Gets the cutover instant between Gregorian and Julian chronologies.
abstract  long getGregorianJulianCutoverMillis()
          Gets the cutover millis between Gregorian and Julian chronologies.
static GJChronology getInstance()
          Factory method returns instances of the default GJ chronology.
static GJChronology getInstance(DateTimeZone zone)
          Factory method returns instances of the default GJ chronology.
static GJChronology getInstance(DateTimeZone zone, long gregorianCutover, boolean includeZero)
          Factory method allowing the Gregorian cutover point and year zero handling to be set.
static GJChronology getInstance(DateTimeZone zone, ReadableInstant gregorianCutover, boolean includeZero)
          Factory method allowing the Gregorian cutover point and year zero handling to be set.
 long getTimeOnlyMillis(long millis)
          Get the millis for a time only field.
 DateTimeField hourClockOfAmPm()
          Get the hour of am/pm (offset to 1-12) field for this chronology.
 DateTimeField hourClockOfDay()
          Get the hour of day (offset to 1-24) field for this chronology.
 DateTimeField hourOfAmPm()
          Get the hour of am/pm (0-11) field for this chronology.
 DateTimeField hourOfDay()
          Get the hour of day (0-23) field for this chronology.
abstract  boolean isIncludeYearZero()
          Gets the flag to say whether to include year zero.
 DateTimeField leapYear()
          Get the leap year flag field for this chronology.
 DateTimeField millisOfDay()
          Get the millis of day field for this chronology.
 DateTimeField millisOfSecond()
          Get the millis of second field for this chronology.
 DateTimeField minuteOfDay()
          Get the minute of day field for this chronology.
 DateTimeField minuteOfHour()
          Get the minute of hour field for this chronology.
 DateTimeField monthOfYear()
          Get the month of year field for this chronology.
 DateTimeField secondOfDay()
          Get the second of day field for this chronology.
 DateTimeField secondOfMinute()
          Get the second of minute field for this chronology.
 DateTimeField weekOfYearWeek()
          Get the week of year week field for this chronology.
 DateTimeField weekOfYearYear()
          Get the week of year year field for this chronology.
 DateTimeField year()
          Get the year field for this chronology.
 DateTimeField yearOfEra()
          Get the year of era field for this chronology.
 
Methods inherited from class org.joda.time.Chronology
asUTC
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static GJChronology getInstance()
Factory method returns instances of the default GJ chronology. This uses a cutover date of October 15, 1582 (Gregorian) 00:00:00 UTC. For this value, October 4, 1582 (Julian) is followed by October 15, 1582 (Gregorian). There is no year zero.

The time zone of the returned instance is UTC.


getInstance

public static GJChronology getInstance(DateTimeZone zone)
Factory method returns instances of the default GJ chronology. This uses a cutover date of October 15, 1582 (Gregorian) 00:00:00 UTC. For this value, October 4, 1582 (Julian) is followed by October 15, 1582 (Gregorian). There is no year zero.

If the time zone specified is null, the default time zone is used.

Parameters:
zone - the time zone to use, or null if default

getInstance

public static GJChronology getInstance(DateTimeZone zone,
                                       ReadableInstant gregorianCutover,
                                       boolean includeZero)
Factory method allowing the Gregorian cutover point and year zero handling to be set. If the cutover millis is Long.MIN_VALUE, a proleptic Gregorian calendar is returned. If the cutover millis is Long.MAX_VALUE, a proleptic Julian calendar is returned.

If the time zone specified is null, the default time zone is used.

Parameters:
zone - the time zone to use, or null if default
gregorianCutover - the cutover as a ReadableInstant, null means default
includeZero - the flag as to whether to include year zero

getInstance

public static GJChronology getInstance(DateTimeZone zone,
                                       long gregorianCutover,
                                       boolean includeZero)
Factory method allowing the Gregorian cutover point and year zero handling to be set. If the cutover is Long.MIN_VALUE, a proleptic Gregorian calendar is returned. If the cutover is Long.MAX_VALUE, a proleptic Julian calendar is returned.

If the time zone specified is null, the default time zone is used.

Parameters:
zone - the time zone to use, or null if default
gregorianCutover - the cutover as milliseconds from 1970-01-01T00:00:00Z
includeZero - the flag as to whether to include year zero

getDateTimeZone

public DateTimeZone getDateTimeZone()
Description copied from class: Chronology
Returns the DateTimeZone that this Chronology operates in, or null if unspecified.

Specified by:
getDateTimeZone in class Chronology
Returns:
DateTimeZone null if unspecified

getGregorianJulianCutover

public Instant getGregorianJulianCutover()
Gets the cutover instant between Gregorian and Julian chronologies.

Returns:
the cutover instant

getGregorianJulianCutoverMillis

public abstract long getGregorianJulianCutoverMillis()
Gets the cutover millis between Gregorian and Julian chronologies.

Returns:
the cutover millis

isIncludeYearZero

public abstract boolean isIncludeYearZero()
Gets the flag to say whether to include year zero.


getTimeOnlyMillis

public long getTimeOnlyMillis(long millis)
Get the millis for a time only field.

Specified by:
getTimeOnlyMillis in class Chronology
Parameters:
millis - the millis to convert to time only
Returns:
millis with the date part stripped

getDateOnlyMillis

public long getDateOnlyMillis(long millis)
Get the millis for a date only field.

Specified by:
getDateOnlyMillis in class Chronology
Parameters:
millis - the millis to convert to date only
Returns:
millis with the time part stripped

millisOfSecond

public DateTimeField millisOfSecond()
Description copied from class: Chronology
Get the millis of second field for this chronology.

Overrides:
millisOfSecond in class Chronology
Returns:
DateTimeField

millisOfDay

public DateTimeField millisOfDay()
Description copied from class: Chronology
Get the millis of day field for this chronology.

Overrides:
millisOfDay in class Chronology
Returns:
DateTimeField

secondOfMinute

public DateTimeField secondOfMinute()
Description copied from class: Chronology
Get the second of minute field for this chronology.

Overrides:
secondOfMinute in class Chronology
Returns:
DateTimeField

secondOfDay

public DateTimeField secondOfDay()
Description copied from class: Chronology
Get the second of day field for this chronology.

Overrides:
secondOfDay in class Chronology
Returns:
DateTimeField

minuteOfHour

public DateTimeField minuteOfHour()
Description copied from class: Chronology
Get the minute of hour field for this chronology.

Overrides:
minuteOfHour in class Chronology
Returns:
DateTimeField

minuteOfDay

public DateTimeField minuteOfDay()
Description copied from class: Chronology
Get the minute of day field for this chronology.

Overrides:
minuteOfDay in class Chronology
Returns:
DateTimeField

hourOfDay

public DateTimeField hourOfDay()
Description copied from class: Chronology
Get the hour of day (0-23) field for this chronology.

Overrides:
hourOfDay in class Chronology
Returns:
DateTimeField

hourClockOfDay

public DateTimeField hourClockOfDay()
Description copied from class: Chronology
Get the hour of day (offset to 1-24) field for this chronology.

Overrides:
hourClockOfDay in class Chronology
Returns:
DateTimeField

hourOfAmPm

public DateTimeField hourOfAmPm()
Description copied from class: Chronology
Get the hour of am/pm (0-11) field for this chronology.

Overrides:
hourOfAmPm in class Chronology
Returns:
DateTimeField

hourClockOfAmPm

public DateTimeField hourClockOfAmPm()
Description copied from class: Chronology
Get the hour of am/pm (offset to 1-12) field for this chronology.

Overrides:
hourClockOfAmPm in class Chronology
Returns:
DateTimeField

amPmOfDay

public DateTimeField amPmOfDay()
Description copied from class: Chronology
Get the AM (0) PM(1) field for this chronology.

Overrides:
amPmOfDay in class Chronology
Returns:
DateTimeField

dayOfWeek

public DateTimeField dayOfWeek()
Description copied from class: Chronology
Get the day of week field for this chronology.

Overrides:
dayOfWeek in class Chronology
Returns:
DateTimeField

dayOfMonth

public DateTimeField dayOfMonth()
Description copied from class: Chronology
Get the day of month field for this chronology.

Overrides:
dayOfMonth in class Chronology
Returns:
DateTimeField

dayOfYear

public DateTimeField dayOfYear()
Description copied from class: Chronology
Get the day of year field for this chronology.

Overrides:
dayOfYear in class Chronology
Returns:
DateTimeField

weekOfYearWeek

public DateTimeField weekOfYearWeek()
Description copied from class: Chronology
Get the week of year week field for this chronology.

Overrides:
weekOfYearWeek in class Chronology
Returns:
DateTimeField

weekOfYearYear

public DateTimeField weekOfYearYear()
Description copied from class: Chronology
Get the week of year year field for this chronology.

Overrides:
weekOfYearYear in class Chronology
Returns:
DateTimeField

monthOfYear

public DateTimeField monthOfYear()
Description copied from class: Chronology
Get the month of year field for this chronology.

Overrides:
monthOfYear in class Chronology
Returns:
DateTimeField

year

public DateTimeField year()
Description copied from class: Chronology
Get the year field for this chronology.

Overrides:
year in class Chronology
Returns:
DateTimeField

yearOfEra

public DateTimeField yearOfEra()
Description copied from class: Chronology
Get the year of era field for this chronology.

Overrides:
yearOfEra in class Chronology
Returns:
DateTimeField

era

public DateTimeField era()
Description copied from class: Chronology
Get the era field for this chronology.

Overrides:
era in class Chronology
Returns:
DateTimeField

leapYear

public DateTimeField leapYear()
Description copied from class: Chronology
Get the leap year flag field for this chronology.

Overrides:
leapYear in class Chronology
Returns:
DateTimeField

Joda Time API

Copyright © 2001-2003 Stephen Colebourne. All Rights Reserved.