public final class ISOChronology extends Chronology implements Serializable
ISOChronology follows the rules of the Gregorian calendar for all time. Thus, dates is the past, and particularly before 1583, may not correspond to historical documents.
ISOChronology is immutable and thread-safe.
Modifier and Type | Field and Description |
---|---|
static ISOChronology |
INSTANCE
The singleton instance of
ISOChronology . |
static int |
MAX_WEEK_BASED_YEAR
Constant for the maximum week-based-year.
|
static int |
MIN_WEEK_BASED_YEAR
Constant for the minimum week-based-year.
|
Modifier and Type | Method and Description |
---|---|
static DateTimeFieldRule<AmPmOfDay> |
amPmOfDayRule()
Gets the rule for the AM/PM of day field.
|
static DateTimeFieldRule<Integer> |
clockHourOfAmPmRule()
Gets the rule for the clock hour of AM/PM field from 1 to 12.
|
static DateTimeFieldRule<Integer> |
clockHourOfDayRule()
Gets the rule for the clock hour of AM/PM field from 1 to 24.
|
static DateTimeFieldRule<Integer> |
dayOfMonthRule()
Gets the rule for the day-of-month field in the ISO chronology.
|
static DateTimeFieldRule<DayOfWeek> |
dayOfWeekRule()
Gets the rule for the day-of-week field.
|
static DateTimeFieldRule<Integer> |
dayOfYearRule()
Gets the rule for the day-of-year field in the ISO chronology.
|
static CalendricalRule<Long> |
epochDays()
Gets the rule for the epoch-days field.
|
String |
getName()
Gets the name of the chronology.
|
static DateTimeFieldRule<Integer> |
hourOfAmPmRule()
Gets the rule for the hour of AM/PM field from 0 to 11.
|
static DateTimeFieldRule<Integer> |
hourOfDayRule()
Gets the rule for the hour-of-day field.
|
static boolean |
isLeapYear(int year)
Checks if the specified year is a leap year according to the ISO calendar system rules.
|
static DateTimeFieldRule<Integer> |
milliOfDayRule()
Gets the rule for the milli-of-day field.
|
static DateTimeFieldRule<Integer> |
milliOfSecondRule()
Gets the rule for the milli-of-second field.
|
static DateTimeFieldRule<Integer> |
minuteOfHourRule()
Gets the rule for the minute-of-hour field.
|
static DateTimeFieldRule<Integer> |
monthOfQuarterRule()
Gets the rule for the month-of-quarter field in the ISO chronology.
|
static DateTimeFieldRule<MonthOfYear> |
monthOfYearRule()
Gets the rule for the month-of-year field in the ISO chronology.
|
static CalendricalRule<Long> |
nanoOfDayRule()
Gets the rule for the nano-of-day field.
|
static DateTimeFieldRule<Integer> |
nanoOfSecondRule()
Gets the rule for the nano-of-second field.
|
static PeriodUnit |
period12Hours()
Gets the period unit for twelve hours, as used by AM/PM.
|
static PeriodUnit |
period24Hours()
Gets the period unit for twenty-four hours, that is often treated as a day.
|
static PeriodUnit |
periodCenturies()
Gets the period unit for centuries of 100 years.
|
static PeriodUnit |
periodDays()
Gets the period unit for days.
|
static PeriodUnit |
periodDecades()
Gets the period unit for decades of 10 years.
|
static PeriodUnit |
periodEras()
Gets the period unit for eras.
|
static PeriodUnit |
periodHours()
Gets the period unit for hours of 60 minutes.
|
static PeriodUnit |
periodMicros()
Gets the period unit for microseconds.
|
static PeriodUnit |
periodMillennia()
Gets the period unit for millennia of 1000 years.
|
static PeriodUnit |
periodMillis()
Gets the period unit for milliseconds.
|
static PeriodUnit |
periodMinutes()
Gets the period unit for minutes of 60 seconds.
|
static PeriodUnit |
periodMonths()
Gets the period unit for months.
|
static PeriodUnit |
periodNanos()
Gets the period unit for nanoseconds.
|
static PeriodUnit |
periodQuarters()
Gets the period unit for quarters of 3 months.
|
static PeriodUnit |
periodSeconds()
Gets the period unit for seconds.
|
static PeriodUnit |
periodWeekBasedYears()
Gets the period unit for week-based-years.
|
static PeriodUnit |
periodWeeks()
Gets the period unit for weeks of 7 days.
|
static PeriodUnit |
periodYears()
Gets the period unit for years of 12 months.
|
static DateTimeFieldRule<QuarterOfYear> |
quarterOfYearRule()
Gets the rule for the quarter-of-year field in the ISO chronology.
|
static DateTimeFieldRule<Integer> |
secondOfDayRule()
Gets the rule for the second-of-day field.
|
static DateTimeFieldRule<Integer> |
secondOfMinuteRule()
Gets the rule for the second-of-minute field.
|
static DateTimeFieldRule<Integer> |
weekBasedYearRule()
Gets the rule for the week-based-year field in the ISO chronology.
|
static DateTimeFieldRule<Integer> |
weekOfMonthRule()
Gets the rule for the week-of-month field in the ISO chronology.
|
static DateTimeFieldRule<Integer> |
weekOfWeekBasedYearRule()
Gets the rule for the week-of-week-based-year field in the ISO chronology.
|
static DateTimeFieldRule<Integer> |
weekOfYearRule()
Gets the rule for the week-of-year field in the ISO chronology.
|
static DateTimeFieldRule<Integer> |
yearRule()
Gets the rule for the year field in the ISO chronology.
|
get, rule, toString
public static final ISOChronology INSTANCE
ISOChronology
.public static final int MIN_WEEK_BASED_YEAR
public static final int MAX_WEEK_BASED_YEAR
public static boolean isLeapYear(int year)
The ISO calendar system applies the current rules for leap years across the whole time-line. In general, a year is a leap year if it is divisible by four without remainder. However, years divisible by 100, are not leap years, with the exception of years divisible by 400 which are.
For example, 1904 is a leap year it is divisible by 4. 1900 was not a leap year as it is divisible by 100, however 2000 was a leap year as it is divisible by 400.
The calculation is proleptic - applying the same rules into the far future and far past. This is historically inaccurate, but is correct for the ISO8601 standard.
year
- the year to check, not validated for rangepublic String getName()
getName
in class Chronology
public static DateTimeFieldRule<Integer> yearRule()
This field counts years using the modern civil calendar system as defined by ISO-8601. There is no historical cutover (as found in historical dates such as from the Julian to Gregorian calendar).
The implication of this is that historical dates will not be accurate. All work requiring accurate historical dates must use the appropriate chronology that defines the Gregorian cutover.
A further implication of the ISO-8601 rules is that the year zero exists. This roughly equates to 1 BC/BCE, however the alignment is not exact as explained above.
public static DateTimeFieldRule<MonthOfYear> monthOfYearRule()
This field counts months sequentially from the start of the year. The values follow the ISO-8601 standard and normal human interactions. These define January as value 1 to December as value 12.
The enum MonthOfYear
should be used wherever possible in
applications when referring to the day of the week to avoid
hard-coding the values.
public static DateTimeFieldRule<Integer> dayOfMonthRule()
This field counts days sequentially from the start of the month. The first day of the month is 1 and the last is 28, 29, 30 or 31 depending on the month and whether it is a leap year.
public static DateTimeFieldRule<Integer> dayOfYearRule()
This field counts days sequentially from the start of the year. The first day of the year is 1 and the last is 365, or 366 in a leap year.
public static DateTimeFieldRule<Integer> weekBasedYearRule()
This field is the year that results from calculating weeks with the ISO-8601 algorithm.
See week of week-based-year
for details.
The week-based-year will either be 52 or 53 weeks long, depending on the result of the algorithm for a particular date.
public static DateTimeFieldRule<Integer> weekOfWeekBasedYearRule()
This field counts weeks using the ISO-8601 algorithm.
The first week of the year is the week which has at least 4 days in the year
using a Monday to Sunday week definition. Thus it is possible for the first
week to start on any day from the 29th December in the previous year to the
4th January in the new year. The year which is aligned with this field is
known as the week-based-year
.
public static DateTimeFieldRule<DayOfWeek> dayOfWeekRule()
This field uses the ISO-8601 values for the day-of-week. These define Monday as value 1 to Sunday as value 7.
The enum DayOfWeek
should be used wherever possible in
applications when referring to the day of the week value to avoid
needing to remember the values from 1 to 7.
public static DateTimeFieldRule<Integer> weekOfYearRule()
This field counts weeks in groups of seven days starting from the first of January. The 1st to the 7th of January is always week 1 while the 8th to the 14th is always week 2.
public static DateTimeFieldRule<QuarterOfYear> quarterOfYearRule()
This field counts quarters sequentially from the start of the year. The first quarter of the year is 1 and the last is 4. Each quarter lasts exactly three months.
public static DateTimeFieldRule<Integer> monthOfQuarterRule()
This field counts months sequentially from the start of the quarter. The first month of the quarter is 1 and the last is 3. Each quarter lasts exactly three months.
public static DateTimeFieldRule<Integer> weekOfMonthRule()
This field counts weeks in groups of seven days starting from the first day of the month. The 1st to the 7th of a month is always week 1 while the 8th to the 14th is always week 2 and so on.
This field can be used to create concepts such as 'the second Saturday'
of a month. To achieve this, setup a DateTimeFields
instance
using this rule and the day-of-week
rule.
public static DateTimeFieldRule<Integer> hourOfDayRule()
This field counts hours sequentially from the start of the day. The values run from 0 to 23.
public static DateTimeFieldRule<Integer> minuteOfHourRule()
This field counts minutes sequentially from the start of the hour. The values run from 0 to 59.
public static DateTimeFieldRule<Integer> secondOfMinuteRule()
This field counts seconds sequentially from the start of the minute. The values run from 0 to 59.
public static DateTimeFieldRule<Integer> nanoOfSecondRule()
This field counts nanoseconds sequentially from the start of the second. The values run from 0 to 999,999,999.
public static DateTimeFieldRule<Integer> secondOfDayRule()
This field counts seconds sequentially from the start of the day. The values run from 0 to 86399.
public static DateTimeFieldRule<Integer> milliOfDayRule()
This field counts milliseconds sequentially from the start of the day. The values run from 0 to 86,399,999.
public static DateTimeFieldRule<Integer> milliOfSecondRule()
This field counts milliseconds sequentially from the start of the second. The values run from 0 to 999.
public static DateTimeFieldRule<AmPmOfDay> amPmOfDayRule()
This field defines the half-day AM/PM value. The hour-of-day from 0 to 11 is defined as AM, while the hours from 12 to 23 are defined as PM. AM is defined with the value 0, while PM is defined with the value 1.
The enum AmPmOfDay
should be used wherever possible in
applications when referring to the day of the week to avoid
hard-coding the values.
public static DateTimeFieldRule<Integer> hourOfAmPmRule()
This field counts hours sequentially from the start of the half-day AM/PM. The values run from 0 to 11.
public static DateTimeFieldRule<Integer> clockHourOfAmPmRule()
This field counts hours sequentially within the half-day AM/PM as normally seen on a clock or watch. The values run from 1 to 12.
public static DateTimeFieldRule<Integer> clockHourOfDayRule()
This field counts hours sequentially within the day starting from 1. The values run from 1 to 24.
public static CalendricalRule<Long> epochDays()
This field counts seconds sequentially from the Java epoch of 1970-01-01.
public static CalendricalRule<Long> nanoOfDayRule()
This field counts seconds sequentially from the start of the day. The values run from 0 to 86,399,999,999,999.
public static PeriodUnit periodEras()
The period unit defines the concept of a period of a eras. An era, based on a simple before/after point on the time-line, is infinite in length. For this rule, an era has an estimated duration of 2,000,000,000 years.
This is a basic unit and has no equivalent period. The estimated duration is equal to 2,000,000,000 years.
public static PeriodUnit periodMillennia()
The period unit defines the concept of a period of a century.
The equivalent period and estimated duration are equal to 10 centuries.
public static PeriodUnit periodCenturies()
The period unit defines the concept of a period of a century.
The equivalent period and estimated duration are equal to 10 decades.
public static PeriodUnit periodDecades()
The period unit defines the concept of a period of a decade.
The equivalent period and estimated duration are equal to 10 years.
public static PeriodUnit periodYears()
The period unit defines the concept of a period of a year.
The equivalent period and estimated duration are equal to 4 quarters.
See yearRule()
for the main date-time field.
public static PeriodUnit periodWeekBasedYears()
The period unit defines the concept of a period of a week-based-year. This is typically 52 weeks, and occasionally 53 weeks.
This is a basic unit and has no equivalent period. The estimated duration is equal to 364.5 days, which is just over 5 weeks.
See weekBasedYearRule()
for the main date-time field.
public static PeriodUnit periodQuarters()
The period unit defines the concept of a period of a quarter.
The equivalent period and estimated duration are equal to 3 months.
See quarterOfYearRule()
for the main date-time field.
public static PeriodUnit periodMonths()
The period unit defines the concept of a period of a month.
This is a basic unit and has no equivalent period. The estimated duration is equal to one-twelfth of a year based on 365.2425 days.
See monthOfYearRule()
for the main date-time field.
public static PeriodUnit periodWeeks()
The period unit defines the concept of a period of a week.
The equivalent period and estimated duration are equal to 7 days.
See weekOfWeekBasedYearRule()
and weekOfYearRule()
for
the main date-time fields.
public static PeriodUnit periodDays()
The period unit defines the concept of a period of a day. This is typically equal to 24 hours, but may vary due to time-zone changes.
This chronology defines two units that could represent a day.
This unit, Days
, represents a day that varies in length based on
time-zone (daylight savings time) changes. It is a basic unit that cannot
be converted to seconds, nanoseconds or Duration
.
By contrast, the 24Hours
unit has a fixed length of
exactly 24 hours allowing it to be converted to seconds, nanoseconds and Duration
.
This is a basic unit and has no equivalent period. The estimated duration is equal to 24 hours.
See dayOfMonthRule()
for the main date-time field.
public static PeriodUnit period24Hours()
The period unit defines the concept of a period of exactly 24 hours that
is often treated as a day. The unit name of "24Hours" is intended to convey
the fact that this is primarily a 24 hour unit that happens to be used as
a day unit on occasion. In most scenarios, the standard Days
unit is more applicable and accurate.
This chronology defines two units that could represent a day.
This unit, 24Hours
, represents a fixed length of exactly 24 hours,
allowing it to be converted to seconds, nanoseconds and Duration
.
By contrast, the Days
unit varies in length based on time-zone (daylight
savings time) changes and cannot be converted to seconds, nanoseconds or Duration
.
The equivalent period and estimated duration are equal to twice the 12 hours unit, making it also equivalent to 24 hours.
public static PeriodUnit period12Hours()
The period unit defines the concept of a period of 12 hours.
The equivalent period and estimated duration are equal to 12 hours.
See amPmOfDayRule()
for the main date-time field.
public static PeriodUnit periodHours()
The period unit defines the concept of a period of a hour.
The equivalent period and estimated duration are equal to 60 minutes.
See hourOfDayRule()
for the main date-time field.
public static PeriodUnit periodMinutes()
The period unit defines the concept of a period of a minute.
The equivalent period and estimated duration are equal to 60 seconds.
See minuteOfHourRule()
for the main date-time field.
public static PeriodUnit periodSeconds()
The period unit defines the concept of a period of a second.
The equivalent period and estimated duration are equal to 1000 milliseconds.
See secondOfMinuteRule()
for the main date-time field.
public static PeriodUnit periodMillis()
The period unit defines the concept of a period of a millisecond.
The equivalent period and estimated duration are equal to 1000 microseconds.
See milliOfSecondRule()
for the main date-time field.
public static PeriodUnit periodMicros()
The period unit defines the concept of a period of a microsecond.
The equivalent period and estimated duration are equal to 1000 nanoseconds.
public static PeriodUnit periodNanos()
The period unit defines the concept of a period of a nanosecond.
This is a basic unit and has no equivalent period. The estimated duration is 1 nanosecond.
See nanoOfSecondRule()
for the main date-time field.
Copyright © 2014. All rights reserved.