public final class JulianChronology extends java.time.chrono.AbstractChronology implements Serializable
This chronology defines the rules of the proleptic Julian calendar system.
This calendar system is the forerunner to the modern Gregorian and ISO calendars.
The Julian differs from the Gregorian only in terms of the leap year rule.
Dates are aligned such that 0001-01-01 (Julian) is 0000-12-30 (ISO).
This class is proleptic. It implements Julian rules to the entire time-line.
This class implements a calendar where January 1st is the start of the year. The history of the start of the year is complex and using the current standard is the most consistent.
The fields are defined as follows:
| Modifier and Type | Field and Description |
|---|---|
static JulianChronology |
INSTANCE
Singleton instance for the Julian chronology.
|
| Constructor and Description |
|---|
JulianChronology()
Deprecated.
Use the singleton
INSTANCE instead. |
| Modifier and Type | Method and Description |
|---|---|
JulianDate |
date(java.time.chrono.Era era,
int yearOfEra,
int month,
int dayOfMonth)
Obtains a local date in Julian calendar system from the
era, year-of-era, month-of-year and day-of-month fields.
|
JulianDate |
date(int prolepticYear,
int month,
int dayOfMonth)
Obtains a local date in Julian calendar system from the
proleptic-year, month-of-year and day-of-month fields.
|
JulianDate |
date(java.time.temporal.TemporalAccessor temporal)
Obtains a Julian local date from another date-time object.
|
JulianDate |
dateEpochDay(long epochDay)
Obtains a local date in the Julian calendar system from the epoch-day.
|
JulianDate |
dateNow()
Obtains the current Julian local date from the system clock in the default time-zone.
|
JulianDate |
dateNow(java.time.Clock clock)
Obtains the current Julian local date from the specified clock.
|
JulianDate |
dateNow(java.time.ZoneId zone)
Obtains the current Julian local date from the system clock in the specified time-zone.
|
JulianDate |
dateYearDay(java.time.chrono.Era era,
int yearOfEra,
int dayOfYear)
Obtains a local date in Julian calendar system from the
era, year-of-era and day-of-year fields.
|
JulianDate |
dateYearDay(int prolepticYear,
int dayOfYear)
Obtains a local date in Julian calendar system from the
proleptic-year and day-of-year fields.
|
JulianEra |
eraOf(int eraValue) |
List<java.time.chrono.Era> |
eras() |
String |
getCalendarType()
Gets the calendar type of the underlying calendar system - 'julian'.
|
String |
getId()
Gets the ID of the chronology - 'Julian'.
|
boolean |
isLeapYear(long prolepticYear)
Checks if the specified year is a leap year.
|
java.time.chrono.ChronoLocalDateTime<JulianDate> |
localDateTime(java.time.temporal.TemporalAccessor temporal)
Obtains a Julian local date-time from another date-time object.
|
int |
prolepticYear(java.time.chrono.Era era,
int yearOfEra) |
java.time.temporal.ValueRange |
range(java.time.temporal.ChronoField field) |
JulianDate |
resolveDate(Map<java.time.temporal.TemporalField,Long> fieldValues,
java.time.format.ResolverStyle resolverStyle) |
java.time.chrono.ChronoZonedDateTime<JulianDate> |
zonedDateTime(java.time.Instant instant,
java.time.ZoneId zone)
Obtains a Julian zoned date-time in this chronology from an
Instant. |
java.time.chrono.ChronoZonedDateTime<JulianDate> |
zonedDateTime(java.time.temporal.TemporalAccessor temporal)
Obtains a Julian zoned date-time from another date-time object.
|
compareTo, equals, hashCode, toStringpublic static final JulianChronology INSTANCE
@Deprecated public JulianChronology()
INSTANCE instead.ServiceLoader.public String getId()
The ID uniquely identifies the Chronology.
It can be used to lookup the Chronology using AbstractChronology.of(String).
getId in interface java.time.chrono.ChronologygetCalendarType()public String getCalendarType()
The Unicode Locale Data Markup Language (LDML) specification does not define an identifier for the Julian calendar, but were it to do so, 'julian' is highly likely to be chosen.
getCalendarType in interface java.time.chrono.ChronologygetId()public JulianDate date(java.time.chrono.Era era, int yearOfEra, int month, int dayOfMonth)
date in interface java.time.chrono.Chronologyera - the Julian era, not nullyearOfEra - the year-of-eramonth - the month-of-yeardayOfMonth - the day-of-monthjava.time.DateTimeException - if unable to create the dateClassCastException - if the era is not a JulianErapublic JulianDate date(int prolepticYear, int month, int dayOfMonth)
date in interface java.time.chrono.ChronologyprolepticYear - the proleptic-yearmonth - the month-of-yeardayOfMonth - the day-of-monthjava.time.DateTimeException - if unable to create the datepublic JulianDate dateYearDay(java.time.chrono.Era era, int yearOfEra, int dayOfYear)
dateYearDay in interface java.time.chrono.Chronologyera - the Julian era, not nullyearOfEra - the year-of-eradayOfYear - the day-of-yearjava.time.DateTimeException - if unable to create the dateClassCastException - if the era is not a JulianErapublic JulianDate dateYearDay(int prolepticYear, int dayOfYear)
dateYearDay in interface java.time.chrono.ChronologyprolepticYear - the proleptic-yeardayOfYear - the day-of-yearjava.time.DateTimeException - if unable to create the datepublic JulianDate dateEpochDay(long epochDay)
dateEpochDay in interface java.time.chrono.ChronologyepochDay - the epoch dayjava.time.DateTimeException - if unable to create the datepublic JulianDate dateNow()
This will query the system clock in the default
time-zone to obtain the current date.
Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
dateNow in interface java.time.chrono.Chronologyjava.time.DateTimeException - if unable to create the datepublic JulianDate dateNow(java.time.ZoneId zone)
This will query the system clock to obtain the current date.
Specifying the time-zone avoids dependence on the default time-zone.
Using this method will prevent the ability to use an alternate clock for testing because the clock is hard-coded.
dateNow in interface java.time.chrono.Chronologyzone - the zone ID to use, not nulljava.time.DateTimeException - if unable to create the datepublic JulianDate dateNow(java.time.Clock clock)
This will query the specified clock to obtain the current date - today.
Using this method allows the use of an alternate clock for testing.
The alternate clock may be introduced using dependency injection.
dateNow in interface java.time.chrono.Chronologyclock - the clock to use, not nulljava.time.DateTimeException - if unable to create the datepublic JulianDate date(java.time.temporal.TemporalAccessor temporal)
date in interface java.time.chrono.Chronologytemporal - the date-time object to convert, not nulljava.time.DateTimeException - if unable to create the datepublic java.time.chrono.ChronoLocalDateTime<JulianDate> localDateTime(java.time.temporal.TemporalAccessor temporal)
localDateTime in interface java.time.chrono.Chronologytemporal - the date-time object to convert, not nulljava.time.DateTimeException - if unable to create the date-timepublic java.time.chrono.ChronoZonedDateTime<JulianDate> zonedDateTime(java.time.temporal.TemporalAccessor temporal)
zonedDateTime in interface java.time.chrono.Chronologytemporal - the date-time object to convert, not nulljava.time.DateTimeException - if unable to create the date-timepublic java.time.chrono.ChronoZonedDateTime<JulianDate> zonedDateTime(java.time.Instant instant, java.time.ZoneId zone)
Instant.zonedDateTime in interface java.time.chrono.Chronologyinstant - the instant to create the date-time from, not nullzone - the time-zone, not nulljava.time.DateTimeException - if the result exceeds the supported rangepublic boolean isLeapYear(long prolepticYear)
A Julian proleptic-year is leap if the remainder after division by four equals zero. This method does not validate the year passed in, and only has a well-defined result for years in the supported range.
isLeapYear in interface java.time.chrono.ChronologyprolepticYear - the proleptic-year to check, not validated for rangepublic int prolepticYear(java.time.chrono.Era era,
int yearOfEra)
prolepticYear in interface java.time.chrono.Chronologypublic JulianEra eraOf(int eraValue)
eraOf in interface java.time.chrono.Chronologypublic List<java.time.chrono.Era> eras()
eras in interface java.time.chrono.Chronologypublic java.time.temporal.ValueRange range(java.time.temporal.ChronoField field)
range in interface java.time.chrono.Chronologypublic JulianDate resolveDate(Map<java.time.temporal.TemporalField,Long> fieldValues, java.time.format.ResolverStyle resolverStyle)
resolveDate in interface java.time.chrono.ChronologyresolveDate in class java.time.chrono.AbstractChronologyCopyright © 2010–2014 ThreeTen.org. All rights reserved.