Joda Time API

org.joda.time
Class Chronology

java.lang.Object
  |
  +--org.joda.time.Chronology
All Implemented Interfaces:
java.io.Serializable
Direct Known Subclasses:
DelegateChronology, GJChronology, ZonedChronology

public abstract class Chronology
extends java.lang.Object
implements java.io.Serializable

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

Chronology subclasses must be immutable.

Various chronologies are supported by subclasses including ISO and GregorianJulian.

This class does not strongly define each field. Subclasses may interpret the fields differently.

Since:
1.0
Author:
Stephen Colebourne
See Also:
ISOChronology, GJChronology, Serialized Form

Constructor Summary
protected Chronology()
          Restricted constructor
 
Method Summary
 DateTimeField centuryOfEra()
          Get the century of era field for this chronology.
 DateTimeField clockhourOfDay()
          Get the hour of day (offset to 1-24) field for this chronology.
 DateTimeField clockhourOfHalfday()
          Get the hour of am/pm (offset to 1-12) 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.
abstract  DateTimeZone getDateTimeZone()
          Returns the DateTimeZone that this Chronology operates in, or null if unspecified.
 long getTimeOnlyMillis(long millis)
          Get the millis for a time only field.
 DateTimeField halfdayOfDay()
          Get the AM(0) PM(1) field for this chronology.
 DateTimeField hourOfDay()
          Get the hour of day (0-23) field for this chronology.
 DateTimeField hourOfHalfday()
          Get the hour of am/pm (0-11) 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 weekOfWeekyear()
          Get the week of a week based year field for this chronology.
 DateTimeField weekyear()
          Get the year of a week based year field for this chronology.
abstract  Chronology withDateTimeZone(DateTimeZone zone)
          Returns an instance of this Chronology that operates in any time zone.
abstract  Chronology withUTC()
          Returns an instance of this Chronology that operates in the UTC time zone.
 DateTimeField year()
          Get the year field for this chronology.
 DateTimeField yearOfCentury()
          Get the year of century field for this chronology.
 DateTimeField yearOfEra()
          Get the year of era field for this chronology.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Chronology

protected Chronology()
Restricted constructor

Method Detail

getDateTimeZone

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

Returns:
DateTimeZone 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.

Returns:
a version of this chronology that ignores time zones

withDateTimeZone

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

Returns:
a version of this chronology with a specific time zone
Throws:
java.lang.IllegalArgumentException - if zone is null
See Also:
ZonedChronology

getTimeOnlyMillis

public long getTimeOnlyMillis(long millis)
Get the millis for a time only field. The default implementation simply returns dayOfYear().remainder(millis).

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. The default implementation simply returns dayOfYear().roundFloor(millis).

Parameters:
millis - the millis to convert to date only
Returns:
millis with the time part stripped

millisOfSecond

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

millisOfDay

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

secondOfMinute

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

secondOfDay

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

minuteOfHour

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

minuteOfDay

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

hourOfDay

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

clockhourOfDay

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

hourOfHalfday

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

clockhourOfHalfday

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

halfdayOfDay

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

dayOfWeek

public 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.

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

dayOfMonth

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

dayOfYear

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

weekOfWeekyear

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

weekyear

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

monthOfYear

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

year

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

yearOfEra

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

yearOfCentury

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

centuryOfEra

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

era

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

Returns:
DateTimeField
Throws:
java.lang.UnsupportedOperationException - if unsupported

Joda Time API

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