|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.joda.time.Chronology
Chronology provides access to the individual date time fields for a chronological calendar system.
Various chronologies are supported by subclasses including ISO and GregorianJulian. To construct a Chronology you should use the factory methods on the chronology subclass in the chrono package.
For example, to obtain the current time in the coptic calendar system:
DateTime dt = new DateTime(CopticChronology.getInstance());
The provided chronology implementations are:
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.
ISOChronology
,
GJChronology
,
GregorianChronology
,
JulianChronology
,
CopticChronology
,
BuddhistChronology
,
EthiopicChronology
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()
Deprecated. Use BuddhistChronology.getInstance() |
static Chronology |
getBuddhist(DateTimeZone zone)
Deprecated. Use BuddhistChronology.getInstance(zone) |
static Chronology |
getBuddhistUTC()
Deprecated. Use BuddhistChronology.getInstanceUTC() |
static Chronology |
getCoptic()
Deprecated. Use CopticChronology.getInstance() |
static Chronology |
getCoptic(DateTimeZone zone)
Deprecated. Use CopticChronology.getInstance(zone) |
static Chronology |
getCopticUTC()
Deprecated. Use CopticChronology.getInstanceUTC() |
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()
Deprecated. Use GJChronology.getInstance() |
static Chronology |
getGJ(DateTimeZone zone)
Deprecated. Use GJChronology.getInstance(zone) |
static Chronology |
getGJUTC()
Deprecated. Use GJChronology.getInstanceUTC() |
static Chronology |
getGregorian()
Deprecated. Use GregorianChronology.getInstance() |
static Chronology |
getGregorian(DateTimeZone zone)
Deprecated. Use GregorianChronology.getInstance(zone) |
static Chronology |
getGregorianUTC()
Deprecated. Use GregorianChronology.getInstanceUTC() |
static Chronology |
getISO()
Deprecated. Use ISOChronology.getInstance() |
static Chronology |
getISO(DateTimeZone zone)
Deprecated. Use ISOChronology.getInstance(zone) |
static Chronology |
getISOUTC()
Deprecated. Use ISOChronology.getInstanceUTC() |
static Chronology |
getJulian()
Deprecated. Use JulianChronology.getInstance() |
static Chronology |
getJulian(DateTimeZone zone)
Deprecated. Use JulianChronology.getInstance(zone) |
static Chronology |
getJulianUTC()
Deprecated. Use JulianChronology.getInstanceUTC() |
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 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 |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public Chronology()
Method Detail |
public static Chronology getISO()
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.
public static Chronology getISOUTC()
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.
public static Chronology getISO(DateTimeZone zone)
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.
zone
- the zone to use, null means default zone
public static Chronology getGJ()
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.
public static Chronology getGJUTC()
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.
public static Chronology getGJ(DateTimeZone zone)
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.
zone
- the zone to use, null means default zone
public static Chronology getGregorian()
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()
.
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.
public static Chronology getGregorianUTC()
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()
.
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.
public static Chronology getGregorian(DateTimeZone zone)
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()
.
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.
zone
- the zone to use, null means default zone
public static Chronology getJulian()
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.
public static Chronology getJulianUTC()
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.
public static Chronology getJulian(DateTimeZone zone)
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.
zone
- the zone to use, null means default zone
public static Chronology getBuddhist()
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.
public static Chronology getBuddhistUTC()
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.
public static Chronology getBuddhist(DateTimeZone zone)
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.
zone
- the zone to use, null means default zone
public static Chronology getCoptic()
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.
public static Chronology getCopticUTC()
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.
public static Chronology getCoptic(DateTimeZone zone)
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.
zone
- the zone to use, null means default zone
public abstract DateTimeZone getZone()
public abstract Chronology withUTC()
public abstract Chronology withZone(DateTimeZone zone)
zone
- to use, or default if null
ZonedChronology
public abstract long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int millisOfDay)
The default implementation calls upon separate DateTimeFields to determine the result. Subclasses are encouraged to provide a more efficient implementation.
year
- year to usemonthOfYear
- month to usedayOfMonth
- day of month to usemillisOfDay
- millisecond to use
IllegalArgumentException
- if the values are invalidpublic abstract long getDateTimeMillis(int year, int monthOfYear, int dayOfMonth, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
The default implementation calls upon separate DateTimeFields to determine the result. Subclasses are encouraged to provide a more efficient implementation.
year
- year to usemonthOfYear
- month to usedayOfMonth
- day of month to usehourOfDay
- hour to useminuteOfHour
- minute to usesecondOfMinute
- second to usemillisOfSecond
- millisecond to use
IllegalArgumentException
- if the values are invalidpublic abstract long getDateTimeMillis(long instant, int hourOfDay, int minuteOfHour, int secondOfMinute, int millisOfSecond)
The default implementation calls upon separate DateTimeFields to determine the result. Subclasses are encouraged to provide a more efficient implementation.
instant
- instant to start fromhourOfDay
- hour to useminuteOfHour
- minute to usesecondOfMinute
- second to usemillisOfSecond
- millisecond to use
IllegalArgumentException
- if the values are invalidpublic abstract void validate(ReadablePartial partial, int[] values)
partial
- the partial instant to validatevalues
- the values to validate, not null, match fields in partial
IllegalArgumentException
- if the instant is invalidpublic abstract int[] get(ReadablePartial partial, long instant)
partial
- the partial instant to useinstant
- the instant to query
public abstract long set(ReadablePartial partial, long instant)
partial
- the partial instant to useinstant
- the instant to update
public abstract int[] get(ReadablePeriod period, long startInstant, long endInstant)
period
- the period instant to usestartInstant
- the start instant of an interval to queryendInstant
- the start instant of an interval to query
public abstract int[] get(ReadablePeriod period, long duration)
period
- the period instant to useduration
- the duration to query
public abstract long add(ReadablePeriod period, long instant, int scalar)
period
- the period to add, null means add nothinginstant
- the instant to add toscalar
- the number of times to add
public abstract long add(long instant, long duration, int scalar)
instant
- the instant to add toduration
- the duration to addscalar
- the number of times to add
public abstract DurationField millis()
public abstract DateTimeField millisOfSecond()
public abstract DateTimeField millisOfDay()
public abstract DurationField seconds()
public abstract DateTimeField secondOfMinute()
public abstract DateTimeField secondOfDay()
public abstract DurationField minutes()
public abstract DateTimeField minuteOfHour()
public abstract DateTimeField minuteOfDay()
public abstract DurationField hours()
public abstract DateTimeField hourOfDay()
public abstract DateTimeField clockhourOfDay()
public abstract DurationField halfdays()
public abstract DateTimeField hourOfHalfday()
public abstract DateTimeField clockhourOfHalfday()
public abstract DateTimeField halfdayOfDay()
public abstract DurationField days()
public abstract DateTimeField dayOfWeek()
DayOfWeek values are defined in DateTimeConstants
.
They use the ISO definitions, where 1 is Monday and 7 is Sunday.
public abstract DateTimeField dayOfMonth()
public abstract DateTimeField dayOfYear()
public abstract DurationField weeks()
public abstract DateTimeField weekOfWeekyear()
public abstract DurationField weekyears()
public abstract DateTimeField weekyear()
public abstract DateTimeField weekyearOfCentury()
public abstract DurationField months()
public abstract DateTimeField monthOfYear()
public abstract DurationField years()
public abstract DateTimeField year()
public abstract DateTimeField yearOfEra()
public abstract DateTimeField yearOfCentury()
public abstract DurationField centuries()
public abstract DateTimeField centuryOfEra()
public abstract DurationField eras()
public abstract DateTimeField era()
public abstract String toString()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |