Class ISOChronology
- java.lang.Object
-
- javax.time.calendar.Chronology
-
- javax.time.calendar.ISOChronology
-
- All Implemented Interfaces:
java.io.Serializable
,Calendrical
public final class ISOChronology extends Chronology implements java.io.Serializable
The ISO-8601 calendar system, which follows the rules of the current de facto world calendar.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.
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static class
ISOChronology.AmPmOfDayRule
Rule implementation.(package private) static class
ISOChronology.DayOfWeekRule
Rule implementation.(package private) static class
ISOChronology.EpochDaysRule
Rule implementation.(package private) static class
ISOChronology.MonthOfYearRule
Rule implementation.(package private) static class
ISOChronology.NanoOfDayRule
Rule implementation.(package private) static class
ISOChronology.QuarterOfYearRule
Rule implementation.(package private) static class
ISOChronology.Rule
Single rule subclass, which means fewer classes to load at startup.(package private) static class
ISOChronology.Unit
Single unit subclass, which means fewer classes to load at startup.
-
Field Summary
Fields Modifier and Type Field Description private static ISOChronology.Unit
_12_HOURS
Period unit for 12 hours half-days, used by AM/PM.private static ISOChronology.Unit
_24_HOURS
Period unit for 24 hour fixed length days.private static ISOChronology.Unit
CENTURIES
Period unit for centuries.private static ISOChronology.Rule
CLOCK_HOUR_OF_AMPM
private static int
CLOCK_HOUR_OF_AMPM_ORDINAL
private static ISOChronology.Rule
CLOCK_HOUR_OF_DAY
private static int
CLOCK_HOUR_OF_DAY_ORDINAL
private static ISOChronology.Rule
DAY_OF_MONTH
private static int
DAY_OF_MONTH_ORDINAL
private static ISOChronology.Rule
DAY_OF_YEAR
private static int
DAY_OF_YEAR_ORDINAL
private static ISOChronology.Unit
DAYS
Period unit for days.(package private) static long
DAYS_0000_TO_1970
The number of days from year zero to year 1970.(package private) static long
DAYS_0000_TO_MJD_EPOCH
The number of days from year zero to the Modified Julian Day epoch of 1858-11-17.(package private) static int
DAYS_PER_CYCLE
The number of days in a 400 year cycle.private static ISOChronology.Unit
DECADES
Period unit for decades.private static ISOChronology.Unit
ERAS
Period unit for eras.private static ISOChronology.Rule
HOUR_OF_AMPM
private static int
HOUR_OF_AMPM_ORDINAL
private static ISOChronology.Rule
HOUR_OF_DAY
private static int
HOUR_OF_DAY_ORDINAL
private static ISOChronology.Unit
HOURS
Period unit for hours.static ISOChronology
INSTANCE
The singleton instance ofISOChronology
.static int
MAX_WEEK_BASED_YEAR
Constant for the maximum week-based-year.private static ISOChronology.Unit
MICROS
Period unit for microseconds.private static ISOChronology.Unit
MILLENNIA
Period unit for millennia.private static ISOChronology.Rule
MILLI_OF_DAY
private static int
MILLI_OF_DAY_ORDINAL
private static ISOChronology.Rule
MILLI_OF_SECOND
private static int
MILLI_OF_SECOND_ORDINAL
private static ISOChronology.Unit
MILLIS
Period unit for milliseconds.static int
MIN_WEEK_BASED_YEAR
Constant for the minimum week-based-year.private static ISOChronology.Rule
MINUTE_OF_HOUR
private static int
MINUTE_OF_HOUR_ORDINAL
private static ISOChronology.Unit
MINUTES
Period unit for minutes.private static ISOChronology.Rule
MONTH_OF_QUARTER
private static int
MONTH_OF_QUARTER_ORDINAL
private static ISOChronology.Unit
MONTHS
Period unit for months.private static ISOChronology.Rule
NANO_OF_SECOND
private static int
NANO_OF_SECOND_ORDINAL
private static ISOChronology.Unit
NANOS
Period unit for nanoseconds.private static ISOChronology.Unit
QUARTERS
Period unit for quarters.private static ISOChronology.Rule[]
RULE_CACHE
Cache of units for deserialization.private static ISOChronology.Rule
SECOND_OF_DAY
private static int
SECOND_OF_DAY_ORDINAL
private static ISOChronology.Rule
SECOND_OF_MINUTE
private static int
SECOND_OF_MINUTE_ORDINAL
private static ISOChronology.Unit
SECONDS
Period unit for seconds.(package private) static int
SECONDS_PER_DAY
The number of seconds in one day.private static long
serialVersionUID
A serialization identifier for this class.private static ISOChronology.Unit[]
UNIT_CACHE
Cache of units for deserialization.private static ISOChronology.Rule
WEEK_BASED_YEAR
private static int
WEEK_BASED_YEAR_ORDINAL
private static ISOChronology.Unit
WEEK_BASED_YEARS
Period unit for week-based-years.private static ISOChronology.Rule
WEEK_OF_MONTH
private static int
WEEK_OF_MONTH_ORDINAL
private static ISOChronology.Rule
WEEK_OF_WEEK_BASED_YEAR
private static int
WEEK_OF_WEEK_BASED_YEAR_ORDINAL
private static ISOChronology.Rule
WEEK_OF_YEAR
private static int
WEEK_OF_YEAR_ORDINAL
private static ISOChronology.Unit
WEEKS
Period unit for weeks.private static ISOChronology.Rule
YEAR
private static int
YEAR_ORDINAL
private static ISOChronology.Unit
YEARS
Period unit for years.
-
Constructor Summary
Constructors Modifier Constructor Description private
ISOChronology()
Restrictive constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static DateTimeFieldRule<AmPmOfDay>
amPmOfDayRule()
Gets the rule for the AM/PM of day field.(package private) static void
checkNotNull(java.lang.Object object, java.lang.String errorMessage)
Validates that the input value is not null.static DateTimeFieldRule<java.lang.Integer>
clockHourOfAmPmRule()
Gets the rule for the clock hour of AM/PM field from 1 to 12.static DateTimeFieldRule<java.lang.Integer>
clockHourOfDayRule()
Gets the rule for the clock hour of AM/PM field from 1 to 24.static DateTimeFieldRule<java.lang.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<java.lang.Integer>
dayOfYearRule()
Gets the rule for the day-of-year field in the ISO chronology.static CalendricalRule<java.lang.Long>
epochDays()
Gets the rule for the epoch-days field.(package private) static LocalDate
getDateFromDayOfYear(int year, int dayOfYear)
Calculates the date from a year and day-of-year.(package private) static DayOfWeek
getDayOfWeekFromDate(LocalDate date)
Calculates the day-of-week from a date.(package private) static int
getDayOfYearFromDate(LocalDate date)
Calculates the day-of-year from a date.java.lang.String
getName()
Gets the name of the chronology.(package private) static int
getWeekBasedYearFromDate(LocalDate date)
Calculates the week-based-year.(package private) static int
getWeekOfWeekBasedYearFromDate(LocalDate date)
Calculates the week of week-based-year.static DateTimeFieldRule<java.lang.Integer>
hourOfAmPmRule()
Gets the rule for the hour of AM/PM field from 0 to 11.static DateTimeFieldRule<java.lang.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.(package private) void
merge(CalendricalMerger merger)
Merges the set of fields known by this chronology.static DateTimeFieldRule<java.lang.Integer>
milliOfDayRule()
Gets the rule for the milli-of-day field.static DateTimeFieldRule<java.lang.Integer>
milliOfSecondRule()
Gets the rule for the milli-of-second field.static DateTimeFieldRule<java.lang.Integer>
minuteOfHourRule()
Gets the rule for the minute-of-hour field.static DateTimeFieldRule<java.lang.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<java.lang.Long>
nanoOfDayRule()
Gets the rule for the nano-of-day field.static DateTimeFieldRule<java.lang.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.private java.lang.Object
readResolve()
Resolves singleton.static DateTimeFieldRule<java.lang.Integer>
secondOfDayRule()
Gets the rule for the second-of-day field.static DateTimeFieldRule<java.lang.Integer>
secondOfMinuteRule()
Gets the rule for the second-of-minute field.static DateTimeFieldRule<java.lang.Integer>
weekBasedYearRule()
Gets the rule for the week-based-year field in the ISO chronology.static DateTimeFieldRule<java.lang.Integer>
weekOfMonthRule()
Gets the rule for the week-of-month field in the ISO chronology.static DateTimeFieldRule<java.lang.Integer>
weekOfWeekBasedYearRule()
Gets the rule for the week-of-week-based-year field in the ISO chronology.static DateTimeFieldRule<java.lang.Integer>
weekOfYearRule()
Gets the rule for the week-of-year field in the ISO chronology.static DateTimeFieldRule<java.lang.Integer>
yearRule()
Gets the rule for the year field in the ISO chronology.-
Methods inherited from class javax.time.calendar.Chronology
get, rule, toString
-
-
-
-
Field Detail
-
INSTANCE
public static final ISOChronology INSTANCE
The singleton instance ofISOChronology
.
-
MIN_WEEK_BASED_YEAR
public static final int MIN_WEEK_BASED_YEAR
Constant for the minimum week-based-year.- See Also:
- Constant Field Values
-
MAX_WEEK_BASED_YEAR
public static final int MAX_WEEK_BASED_YEAR
Constant for the maximum week-based-year.- See Also:
- Constant Field Values
-
serialVersionUID
private static final long serialVersionUID
A serialization identifier for this class.- See Also:
- Constant Field Values
-
SECONDS_PER_DAY
static final int SECONDS_PER_DAY
The number of seconds in one day.- See Also:
- Constant Field Values
-
DAYS_PER_CYCLE
static final int DAYS_PER_CYCLE
The number of days in a 400 year cycle.- See Also:
- Constant Field Values
-
DAYS_0000_TO_1970
static final long DAYS_0000_TO_1970
The number of days from year zero to year 1970. There are five 400 year cycles from year zero to 2000. There are 7 leap years from 1970 to 2000.- See Also:
- Constant Field Values
-
DAYS_0000_TO_MJD_EPOCH
static final long DAYS_0000_TO_MJD_EPOCH
The number of days from year zero to the Modified Julian Day epoch of 1858-11-17.- See Also:
- Constant Field Values
-
NANOS
private static final ISOChronology.Unit NANOS
Period unit for nanoseconds.
-
MICROS
private static final ISOChronology.Unit MICROS
Period unit for microseconds.
-
MILLIS
private static final ISOChronology.Unit MILLIS
Period unit for milliseconds.
-
SECONDS
private static final ISOChronology.Unit SECONDS
Period unit for seconds.
-
MINUTES
private static final ISOChronology.Unit MINUTES
Period unit for minutes.
-
HOURS
private static final ISOChronology.Unit HOURS
Period unit for hours.
-
_12_HOURS
private static final ISOChronology.Unit _12_HOURS
Period unit for 12 hours half-days, used by AM/PM.
-
_24_HOURS
private static final ISOChronology.Unit _24_HOURS
Period unit for 24 hour fixed length days.
-
DAYS
private static final ISOChronology.Unit DAYS
Period unit for days.
-
WEEKS
private static final ISOChronology.Unit WEEKS
Period unit for weeks.
-
MONTHS
private static final ISOChronology.Unit MONTHS
Period unit for months.
-
QUARTERS
private static final ISOChronology.Unit QUARTERS
Period unit for quarters.
-
WEEK_BASED_YEARS
private static final ISOChronology.Unit WEEK_BASED_YEARS
Period unit for week-based-years.
-
YEARS
private static final ISOChronology.Unit YEARS
Period unit for years.
-
DECADES
private static final ISOChronology.Unit DECADES
Period unit for decades.
-
CENTURIES
private static final ISOChronology.Unit CENTURIES
Period unit for centuries.
-
MILLENNIA
private static final ISOChronology.Unit MILLENNIA
Period unit for millennia.
-
ERAS
private static final ISOChronology.Unit ERAS
Period unit for eras.
-
UNIT_CACHE
private static final ISOChronology.Unit[] UNIT_CACHE
Cache of units for deserialization. Indices must match ordinal passed to unit constructor.
-
NANO_OF_SECOND_ORDINAL
private static final int NANO_OF_SECOND_ORDINAL
- See Also:
- Constant Field Values
-
MILLI_OF_SECOND_ORDINAL
private static final int MILLI_OF_SECOND_ORDINAL
- See Also:
- Constant Field Values
-
MILLI_OF_DAY_ORDINAL
private static final int MILLI_OF_DAY_ORDINAL
- See Also:
- Constant Field Values
-
SECOND_OF_MINUTE_ORDINAL
private static final int SECOND_OF_MINUTE_ORDINAL
- See Also:
- Constant Field Values
-
SECOND_OF_DAY_ORDINAL
private static final int SECOND_OF_DAY_ORDINAL
- See Also:
- Constant Field Values
-
MINUTE_OF_HOUR_ORDINAL
private static final int MINUTE_OF_HOUR_ORDINAL
- See Also:
- Constant Field Values
-
CLOCK_HOUR_OF_AMPM_ORDINAL
private static final int CLOCK_HOUR_OF_AMPM_ORDINAL
- See Also:
- Constant Field Values
-
HOUR_OF_AMPM_ORDINAL
private static final int HOUR_OF_AMPM_ORDINAL
- See Also:
- Constant Field Values
-
CLOCK_HOUR_OF_DAY_ORDINAL
private static final int CLOCK_HOUR_OF_DAY_ORDINAL
- See Also:
- Constant Field Values
-
HOUR_OF_DAY_ORDINAL
private static final int HOUR_OF_DAY_ORDINAL
- See Also:
- Constant Field Values
-
DAY_OF_MONTH_ORDINAL
private static final int DAY_OF_MONTH_ORDINAL
- See Also:
- Constant Field Values
-
DAY_OF_YEAR_ORDINAL
private static final int DAY_OF_YEAR_ORDINAL
- See Also:
- Constant Field Values
-
WEEK_OF_MONTH_ORDINAL
private static final int WEEK_OF_MONTH_ORDINAL
- See Also:
- Constant Field Values
-
WEEK_OF_WEEK_BASED_YEAR_ORDINAL
private static final int WEEK_OF_WEEK_BASED_YEAR_ORDINAL
- See Also:
- Constant Field Values
-
WEEK_OF_YEAR_ORDINAL
private static final int WEEK_OF_YEAR_ORDINAL
- See Also:
- Constant Field Values
-
MONTH_OF_QUARTER_ORDINAL
private static final int MONTH_OF_QUARTER_ORDINAL
- See Also:
- Constant Field Values
-
WEEK_BASED_YEAR_ORDINAL
private static final int WEEK_BASED_YEAR_ORDINAL
- See Also:
- Constant Field Values
-
YEAR_ORDINAL
private static final int YEAR_ORDINAL
- See Also:
- Constant Field Values
-
NANO_OF_SECOND
private static final ISOChronology.Rule NANO_OF_SECOND
-
MILLI_OF_SECOND
private static final ISOChronology.Rule MILLI_OF_SECOND
-
MILLI_OF_DAY
private static final ISOChronology.Rule MILLI_OF_DAY
-
SECOND_OF_MINUTE
private static final ISOChronology.Rule SECOND_OF_MINUTE
-
SECOND_OF_DAY
private static final ISOChronology.Rule SECOND_OF_DAY
-
MINUTE_OF_HOUR
private static final ISOChronology.Rule MINUTE_OF_HOUR
-
CLOCK_HOUR_OF_AMPM
private static final ISOChronology.Rule CLOCK_HOUR_OF_AMPM
-
HOUR_OF_AMPM
private static final ISOChronology.Rule HOUR_OF_AMPM
-
CLOCK_HOUR_OF_DAY
private static final ISOChronology.Rule CLOCK_HOUR_OF_DAY
-
HOUR_OF_DAY
private static final ISOChronology.Rule HOUR_OF_DAY
-
DAY_OF_MONTH
private static final ISOChronology.Rule DAY_OF_MONTH
-
DAY_OF_YEAR
private static final ISOChronology.Rule DAY_OF_YEAR
-
WEEK_OF_MONTH
private static final ISOChronology.Rule WEEK_OF_MONTH
-
WEEK_OF_WEEK_BASED_YEAR
private static final ISOChronology.Rule WEEK_OF_WEEK_BASED_YEAR
-
WEEK_OF_YEAR
private static final ISOChronology.Rule WEEK_OF_YEAR
-
MONTH_OF_QUARTER
private static final ISOChronology.Rule MONTH_OF_QUARTER
-
WEEK_BASED_YEAR
private static final ISOChronology.Rule WEEK_BASED_YEAR
-
YEAR
private static final ISOChronology.Rule YEAR
-
RULE_CACHE
private static final ISOChronology.Rule[] RULE_CACHE
Cache of units for deserialization. Indices must match ordinal passed to rule constructor.
-
-
Method Detail
-
isLeapYear
public static boolean isLeapYear(int year)
Checks if the specified year is a leap year according to the ISO calendar system rules.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.
- Parameters:
year
- the year to check, not validated for range- Returns:
- true if the year is a leap year
-
checkNotNull
static void checkNotNull(java.lang.Object object, java.lang.String errorMessage)
Validates that the input value is not null.- Parameters:
object
- the object to checkerrorMessage
- the error to throw- Throws:
java.lang.NullPointerException
- if the object is null
-
getDayOfWeekFromDate
static DayOfWeek getDayOfWeekFromDate(LocalDate date)
Calculates the day-of-week from a date.- Parameters:
date
- the date to use, not null- Returns:
- the day-of-week
-
getDayOfYearFromDate
static int getDayOfYearFromDate(LocalDate date)
Calculates the day-of-year from a date.- Parameters:
date
- the date to use, not null- Returns:
- the day-of-year
-
getDateFromDayOfYear
static LocalDate getDateFromDayOfYear(int year, int dayOfYear)
Calculates the date from a year and day-of-year.- Parameters:
year
- the year, validdayOfYear
- the day-of-year, valid- Returns:
- the date, never null
-
getWeekBasedYearFromDate
static int getWeekBasedYearFromDate(LocalDate date)
Calculates the week-based-year.- Parameters:
date
- the date, not null- Returns:
- the week-based-year
-
getWeekOfWeekBasedYearFromDate
static int getWeekOfWeekBasedYearFromDate(LocalDate date)
Calculates the week of week-based-year.- Parameters:
date
- the date to use, not null- Returns:
- the week
-
readResolve
private java.lang.Object readResolve()
Resolves singleton.- Returns:
- the singleton instance
-
getName
public java.lang.String getName()
Gets the name of the chronology.- Specified by:
getName
in classChronology
- Returns:
- the name of the chronology, never null
-
yearRule
public static DateTimeFieldRule<java.lang.Integer> yearRule()
Gets the rule for the year field in the ISO chronology.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.
- Returns:
- the rule for the year field, never null
-
monthOfYearRule
public static DateTimeFieldRule<MonthOfYear> monthOfYearRule()
Gets the rule for the month-of-year field in the ISO chronology.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.- Returns:
- the rule for the month-of-year field, never null
-
dayOfMonthRule
public static DateTimeFieldRule<java.lang.Integer> dayOfMonthRule()
Gets the rule for the day-of-month field in the ISO chronology.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.
- Returns:
- the rule for the day-of-month field, never null
-
dayOfYearRule
public static DateTimeFieldRule<java.lang.Integer> dayOfYearRule()
Gets the rule for the day-of-year field in the ISO chronology.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.
- Returns:
- the rule for the day-of-year field, never null
-
weekBasedYearRule
public static DateTimeFieldRule<java.lang.Integer> weekBasedYearRule()
Gets the rule for the week-based-year field in the ISO chronology.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.
- Returns:
- the rule for the week-based-year field, never null
-
weekOfWeekBasedYearRule
public static DateTimeFieldRule<java.lang.Integer> weekOfWeekBasedYearRule()
Gets the rule for the week-of-week-based-year field in the ISO chronology.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
.- Returns:
- the rule for the week-of-week-based-year field, never null
-
dayOfWeekRule
public static DateTimeFieldRule<DayOfWeek> dayOfWeekRule()
Gets the rule for the day-of-week field.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.- Returns:
- the rule for the day-of-week field, never null
-
weekOfYearRule
public static DateTimeFieldRule<java.lang.Integer> weekOfYearRule()
Gets the rule for the week-of-year field in the ISO chronology.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.
- Returns:
- the rule for the week-of-year field, never null
-
quarterOfYearRule
public static DateTimeFieldRule<QuarterOfYear> quarterOfYearRule()
Gets the rule for the quarter-of-year field in the ISO chronology.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.
- Returns:
- the rule for the quarter-of-year field, never null
-
monthOfQuarterRule
public static DateTimeFieldRule<java.lang.Integer> monthOfQuarterRule()
Gets the rule for the month-of-quarter field in the ISO chronology.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.
- Returns:
- the rule for the month-of-quarter field, never null
-
weekOfMonthRule
public static DateTimeFieldRule<java.lang.Integer> weekOfMonthRule()
Gets the rule for the week-of-month field in the ISO chronology.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 theday-of-week
rule.- Returns:
- the rule for the week-of-month field, never null
-
hourOfDayRule
public static DateTimeFieldRule<java.lang.Integer> hourOfDayRule()
Gets the rule for the hour-of-day field.This field counts hours sequentially from the start of the day. The values run from 0 to 23.
- Returns:
- the rule for the hour-of-day field, never null
-
minuteOfHourRule
public static DateTimeFieldRule<java.lang.Integer> minuteOfHourRule()
Gets the rule for the minute-of-hour field.This field counts minutes sequentially from the start of the hour. The values run from 0 to 59.
- Returns:
- the rule for the minute-of-hour field, never null
-
secondOfMinuteRule
public static DateTimeFieldRule<java.lang.Integer> secondOfMinuteRule()
Gets the rule for the second-of-minute field.This field counts seconds sequentially from the start of the minute. The values run from 0 to 59.
- Returns:
- the rule for the second-of-minute field, never null
-
nanoOfSecondRule
public static DateTimeFieldRule<java.lang.Integer> nanoOfSecondRule()
Gets the rule for the nano-of-second field.This field counts nanoseconds sequentially from the start of the second. The values run from 0 to 999,999,999.
- Returns:
- the rule for the nano-of-second field, never null
-
secondOfDayRule
public static DateTimeFieldRule<java.lang.Integer> secondOfDayRule()
Gets the rule for the second-of-day field.This field counts seconds sequentially from the start of the day. The values run from 0 to 86399.
- Returns:
- the rule for the second-of-day field, never null
-
milliOfDayRule
public static DateTimeFieldRule<java.lang.Integer> milliOfDayRule()
Gets the rule for the milli-of-day field.This field counts milliseconds sequentially from the start of the day. The values run from 0 to 86,399,999.
- Returns:
- the rule for the milli-of-day field, never null
-
milliOfSecondRule
public static DateTimeFieldRule<java.lang.Integer> milliOfSecondRule()
Gets the rule for the milli-of-second field.This field counts milliseconds sequentially from the start of the second. The values run from 0 to 999.
- Returns:
- the rule for the milli-of-second field, never null
-
amPmOfDayRule
public static DateTimeFieldRule<AmPmOfDay> amPmOfDayRule()
Gets the rule for the AM/PM of day field.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.- Returns:
- the rule for the am/pm of day field, never null
-
hourOfAmPmRule
public static DateTimeFieldRule<java.lang.Integer> hourOfAmPmRule()
Gets the rule for the hour of AM/PM field from 0 to 11.This field counts hours sequentially from the start of the half-day AM/PM. The values run from 0 to 11.
- Returns:
- the rule for the hour of AM/PM field, never null
-
clockHourOfAmPmRule
public static DateTimeFieldRule<java.lang.Integer> clockHourOfAmPmRule()
Gets the rule for the clock hour of AM/PM field from 1 to 12.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.
- Returns:
- the rule for the hour of AM/PM field, never null
-
clockHourOfDayRule
public static DateTimeFieldRule<java.lang.Integer> clockHourOfDayRule()
Gets the rule for the clock hour of AM/PM field from 1 to 24.This field counts hours sequentially within the day starting from 1. The values run from 1 to 24.
- Returns:
- the rule for the clock-hour-of-day field, never null
-
epochDays
public static CalendricalRule<java.lang.Long> epochDays()
Gets the rule for the epoch-days field.This field counts seconds sequentially from the Java epoch of 1970-01-01.
- Returns:
- the rule for the epoch-days field, never null
-
nanoOfDayRule
public static CalendricalRule<java.lang.Long> nanoOfDayRule()
Gets the rule for the nano-of-day field.This field counts seconds sequentially from the start of the day. The values run from 0 to 86,399,999,999,999.
- Returns:
- the rule for the nano-of-day field, never null
-
periodEras
public static PeriodUnit periodEras()
Gets the period unit for eras.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.
- Returns:
- the period unit for eras, never null
-
periodMillennia
public static PeriodUnit periodMillennia()
Gets the period unit for millennia of 1000 years.The period unit defines the concept of a period of a century.
The equivalent period and estimated duration are equal to 10 centuries.
- Returns:
- the period unit for millennia, never null
-
periodCenturies
public static PeriodUnit periodCenturies()
Gets the period unit for centuries of 100 years.The period unit defines the concept of a period of a century.
The equivalent period and estimated duration are equal to 10 decades.
- Returns:
- the period unit for centuries, never null
-
periodDecades
public static PeriodUnit periodDecades()
Gets the period unit for decades of 10 years.The period unit defines the concept of a period of a decade.
The equivalent period and estimated duration are equal to 10 years.
- Returns:
- the period unit for decades, never null
-
periodYears
public static PeriodUnit periodYears()
Gets the period unit for years of 12 months.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.- Returns:
- the period unit for years, never null
-
periodWeekBasedYears
public static PeriodUnit periodWeekBasedYears()
Gets the period unit for week-based-years.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.- Returns:
- the period unit for week-based-years, never null
-
periodQuarters
public static PeriodUnit periodQuarters()
Gets the period unit for quarters of 3 months.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.- Returns:
- the period unit for quarters, never null
-
periodMonths
public static PeriodUnit periodMonths()
Gets the period unit for months.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.- Returns:
- the period unit for months, never null
-
periodWeeks
public static PeriodUnit periodWeeks()
Gets the period unit for weeks of 7 days.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()
andweekOfYearRule()
for the main date-time fields.- Returns:
- the period unit for weeks, never null
-
periodDays
public static PeriodUnit periodDays()
Gets the period unit for days.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 orDuration
. By contrast, the24Hours
unit has a fixed length of exactly 24 hours allowing it to be converted to seconds, nanoseconds andDuration
.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.- Returns:
- the period unit for accurate, variable length, days, never null
-
period24Hours
public static PeriodUnit period24Hours()
Gets the period unit for twenty-four hours, that is often treated as a day.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 andDuration
. By contrast, theDays
unit varies in length based on time-zone (daylight savings time) changes and cannot be converted to seconds, nanoseconds orDuration
.The equivalent period and estimated duration are equal to twice the 12 hours unit, making it also equivalent to 24 hours.
- Returns:
- the period unit for fixed, 24 hour, days, never null
-
period12Hours
public static PeriodUnit period12Hours()
Gets the period unit for twelve hours, as used by AM/PM.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.- Returns:
- the period unit for twelve hours, never null
-
periodHours
public static PeriodUnit periodHours()
Gets the period unit for hours of 60 minutes.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.- Returns:
- the period unit for hours, never null
-
periodMinutes
public static PeriodUnit periodMinutes()
Gets the period unit for minutes of 60 seconds.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.- Returns:
- the period unit for minutes, never null
-
periodSeconds
public static PeriodUnit periodSeconds()
Gets the period unit for seconds.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.- Returns:
- the period unit for seconds, never null
-
periodMillis
public static PeriodUnit periodMillis()
Gets the period unit for milliseconds.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.- Returns:
- the period unit for milliseconds, never null
-
periodMicros
public static PeriodUnit periodMicros()
Gets the period unit for microseconds.The period unit defines the concept of a period of a microsecond.
The equivalent period and estimated duration are equal to 1000 nanoseconds.
- Returns:
- the period unit for microseconds, never null
-
periodNanos
public static PeriodUnit periodNanos()
Gets the period unit for nanoseconds.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.- Returns:
- the period unit for nanoseconds, never null
-
merge
void merge(CalendricalMerger merger)
Merges the set of fields known by this chronology.- Parameters:
merger
- the merger to use, not null
-
-