IChronology Interface

Definition

A calendar system, used to organize and identify dates.

[Android.Runtime.Register("java/time/chrono/Chronology", "", "Java.Time.Chrono.IChronologyInvoker", ApiSince=26)]
public interface IChronology : IDisposable, Java.Interop.IJavaPeerable, Java.Lang.IComparable
[<Android.Runtime.Register("java/time/chrono/Chronology", "", "Java.Time.Chrono.IChronologyInvoker", ApiSince=26)>]
type IChronology = interface
    interface IComparable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
Derived
Attributes
Implements

Remarks

A calendar system, used to organize and identify dates.

The main date and time API is built on the ISO calendar system. The chronology operates behind the scenes to represent the general concept of a calendar system. For example, the Japanese, Taiwan Calendar, Thai Buddhist and others.

Most other calendar systems also operate on the shared concepts of year, month and day, linked to the cycles of the Earth around the Sun, and the Moon around the Earth. These shared concepts are defined by ChronoField and are available for use by any Chronology implementation:

LocalDate isoDate = ...
              ThaiBuddhistDate thaiDate = ...
              int isoYear = isoDate.get(ChronoField.YEAR);
              int thaiYear = thaiDate.get(ChronoField.YEAR);

As shown, although the date objects are in different calendar systems, represented by different Chronology instances, both can be queried using the same constant on ChronoField. For a full discussion of the implications of this, see ChronoLocalDate. In general, the advice is to use the known ISO-based LocalDate, rather than ChronoLocalDate.

While a Chronology object typically uses ChronoField and is based on an era, year-of-era, month-of-year, day-of-month model of a date, this is not required. A Chronology instance may represent a totally different kind of calendar system, such as the Mayan.

In practical terms, the Chronology instance also acts as a factory. The #of(String) method allows an instance to be looked up by identifier, while the #ofLocale(Locale) method allows lookup by locale.

The Chronology instance provides a set of methods to create ChronoLocalDate instances. The date classes are used to manipulate specific dates. <ul> <li> #dateNow() dateNow()<li> #dateNow(Clock) dateNow(clock)<li> #dateNow(ZoneId) dateNow(zone)<li> #date(int, int, int) date(yearProleptic, month, day)<li> #date(Era, int, int, int) date(era, yearOfEra, month, day)<li> #dateYearDay(int, int) dateYearDay(yearProleptic, dayOfYear)<li> #dateYearDay(Era, int, int) dateYearDay(era, yearOfEra, dayOfYear)<li> #date(TemporalAccessor) date(TemporalAccessor)</ul>

<h2 id="addcalendars">Adding New Calendars</h2> The set of available chronologies can be extended by applications. Adding a new calendar system requires the writing of an implementation of Chronology, ChronoLocalDate and Era. The majority of the logic specific to the calendar system will be in the ChronoLocalDate implementation. The Chronology implementation acts as a factory.

To permit the discovery of additional chronologies, the java.util.ServiceLoader ServiceLoader is used. A file must be added to the META-INF/services directory with the name 'java.time.chrono.Chronology' listing the implementation classes. See the ServiceLoader for more details on service loading. For lookup by id or calendarType, the system provided calendars are found first followed by application provided calendars.

Each chronology must define a chronology ID that is unique within the system. If the chronology represents a calendar system defined by the CLDR specification then the calendar type is the concatenation of the CLDR type and, if applicable, the CLDR variant.

Added in 1.8.

Java documentation for java.time.chrono.Chronology.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Properties

AvailableChronologies

Returns the available chronologies.

CalendarType
Handle

Gets the JNI value of the underlying Android object.

(Inherited from IJavaObject)
Id
JniIdentityHashCode

Returns the value of java.lang.System.identityHashCode() for the wrapped instance.

(Inherited from IJavaPeerable)
JniManagedPeerState

State of the managed peer.

(Inherited from IJavaPeerable)
JniPeerMembers

Member access and invocation support.

(Inherited from IJavaPeerable)
PeerReference

Returns a JniObjectReference of the wrapped Java object instance.

(Inherited from IJavaPeerable)

Methods

CompareTo(IChronology)

Compares this chronology to another chronology.

CompareTo(Object)

Compares this object with the specified object for order.

(Inherited from IComparable)
Date(IEra, Int32, Int32, Int32)

Obtains a local date in this chronology from the era, year-of-era, month-of-year and day-of-month fields.

Date(Int32, Int32, Int32)

Obtains a local date in this chronology from the proleptic-year, month-of-year and day-of-month fields.

Date(ITemporalAccessor)

Obtains a local date in this chronology from another temporal object.

DateEpochDay(Int64)

Obtains a local date in this chronology from the epoch-day.

DateNow()

Obtains the current local date in this chronology from the system clock in the default time-zone.

DateNow(Clock)

Obtains the current local date in this chronology from the specified clock.

DateNow(ZoneId)

Obtains the current local date in this chronology from the system clock in the specified time-zone.

DateYearDay(IEra, Int32, Int32)

Obtains a local date in this chronology from the era, year-of-era and day-of-year fields.

DateYearDay(Int32, Int32)

Obtains a local date in this chronology from the proleptic-year and day-of-year fields.

Disposed()

Called when the instance has been disposed.

(Inherited from IJavaPeerable)
DisposeUnlessReferenced()

If there are no outstanding references to this instance, then calls Dispose(); otherwise, does nothing.

(Inherited from IJavaPeerable)
EpochSecond(IEra, Int32, Int32, Int32, Int32, Int32, Int32, ZoneOffset)

Gets the number of seconds from the epoch of 1970-01-01T00:00:00Z.

EpochSecond(Int32, Int32, Int32, Int32, Int32, Int32, ZoneOffset)

Gets the number of seconds from the epoch of 1970-01-01T00:00:00Z.

Equals(Object)

Checks if this chronology is equal to another chronology.

EraOf(Int32)

Creates the chronology era object from the numeric value.

Eras()

Gets the list of eras for the chronology.

Finalized()

Called when the instance has been finalized.

(Inherited from IJavaPeerable)
From(ITemporalAccessor)

Obtains an instance of Chronology from a temporal object.

GetDisplayName(TextStyle, Locale)

Gets the textual representation of this chronology.

GetHashCode()

A hash code for this chronology.

IsLeapYear(Int64)

Checks if the specified year is a leap year.

LocalDateTime(ITemporalAccessor)

Obtains a local date-time in this chronology from another temporal object.

Of(String)

Obtains an instance of Chronology from a chronology ID or calendar system type.

OfLocale(Locale)

Obtains an instance of Chronology from a locale.

Period(Int32, Int32, Int32)

Obtains a period for this chronology based on years, months and days.

ProlepticYear(IEra, Int32)

Calculates the proleptic-year given the era and year-of-era.

Range(ChronoField)

Gets the range of valid values for the specified field.

ResolveDate(IDictionary<ITemporalField,Long>, ResolverStyle)

Resolves parsed ChronoField values into a date during parsing.

SetJniIdentityHashCode(Int32)

Set the value returned by JniIdentityHashCode.

(Inherited from IJavaPeerable)
SetJniManagedPeerState(JniManagedPeerStates) (Inherited from IJavaPeerable)
SetPeerReference(JniObjectReference)

Set the value returned by PeerReference.

(Inherited from IJavaPeerable)
ToString()

Outputs this chronology as a String.

UnregisterFromRuntime()

Unregister this instance so that the runtime will not return it from future Java.Interop.JniRuntime+JniValueManager.PeekValue invocations.

(Inherited from IJavaPeerable)
ZonedDateTime(Instant, ZoneId)

Obtains a ChronoZonedDateTime in this chronology from an Instant.

ZonedDateTime(ITemporalAccessor)

Obtains a ChronoZonedDateTime in this chronology from another temporal object.

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to