Year Class

Definition

A year in the ISO-8601 calendar system, such as 2007.

[Android.Runtime.Register("java/time/Year", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class Year : Java.Lang.Object, IDisposable, Java.IO.ISerializable, Java.Lang.IComparable, Java.Time.Temporal.ITemporal, Java.Time.Temporal.ITemporalAdjuster
[<Android.Runtime.Register("java/time/Year", ApiSince=26, DoNotGenerateAcw=true)>]
type Year = class
    inherit Object
    interface ISerializable
    interface IJavaObject
    interface IDisposable
    interface IJavaPeerable
    interface IComparable
    interface ITemporal
    interface ITemporalAccessor
    interface ITemporalAdjuster
Inheritance
Attributes
Implements

Remarks

A year in the ISO-8601 calendar system, such as 2007.

Year is an immutable date-time object that represents a year. Any field that can be derived from a year can be obtained.

<b>Note that years in the ISO chronology only align with years in the Gregorian-Julian system for modern years. Parts of Russia did not switch to the modern Gregorian/ISO rules until 1920. As such, historical years must be treated with caution.</b>

This class does not store or represent a month, day, time or time-zone. For example, the value "2007" can be stored in a Year.

Years represented by this class follow the ISO-8601 standard and use the proleptic numbering system. Year 1 is preceded by year 0, then by year -1.

The ISO-8601 calendar system is the modern civil calendar system used today in most of the world. It is equivalent to the proleptic Gregorian calendar system, in which today's rules for leap years are applied for all time. For most applications written today, the ISO-8601 rules are entirely suitable. However, any application that makes use of historical dates, and requires them to be accurate will find the ISO-8601 approach unsuitable.

Added in 1.8.

Java documentation for java.time.Year.

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.

Fields

Name Description
MaxValue

The maximum supported year, '+999,999,999'.

MinValue

The minimum supported year, '-999,999,999'.

Properties

Name Description
Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IsLeap

Checks if the year is a leap year, according to the ISO proleptic calendar system rules.

JniIdentityHashCode

Gets the identity hash code assigned to this Java peer by the interop runtime.

(Inherited from Object)
JniManagedPeerState (Inherited from JavaObject)
JniPeerMembers
PeerReference

Gets the JNI object reference for this Java peer.

(Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

(Inherited from Object)
Value

Gets the year value.

Methods

Name Description
AdjustInto(ITemporal)

Adjusts the specified temporal object to have this year.

AtDay(Int32)

Combines this year with a day-of-year to create a LocalDate.

AtMonth(Int32)

Combines this year with a month to create a YearMonth.

AtMonth(Month)

Combines this year with a month to create a YearMonth.

AtMonthDay(MonthDay)

Combines this year with a month-day to create a LocalDate.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
CompareTo(Year)

Compares this year to another year.

Construct(JniObjectReference, JniObjectReferenceOptions) (Inherited from JavaObject)
Dispose()

Releases the resources held by this Java peer.

(Inherited from Object)
Dispose(Boolean)

Releases the resources held by this Java peer.

(Inherited from Object)
DisposeUnlessReferenced() (Inherited from JavaObject)
Equals(Object) (Inherited from JavaObject)
Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
Format(DateTimeFormatter)

Formats this year using the specified formatter.

From(ITemporalAccessor)

Obtains an instance of Year from a temporal object.

Get(ITemporalField)

Gets the value of the specified field from this year as an int.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
GetLong(ITemporalField)

Gets the value of the specified field from this year as a long.

InvokeIsLeap(Int64)

Checks if the year is a leap year, according to the ISO proleptic calendar system rules.

IsAfter(Year)

Checks if this year is after the specified year.

IsBefore(Year)

Checks if this year is before the specified year.

IsSupported(ITemporalField)

Checks if the specified field is supported.

IsSupported(ITemporalUnit)

Checks if the specified unit is supported.

IsValidMonthDay(MonthDay)

Checks if the month-day is valid for this year.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Length()

Gets the length of this year in days.

Minus(Int64, ITemporalUnit)

Returns a copy of this year with the specified amount subtracted.

Minus(ITemporalAmount)

Returns a copy of this year with the specified amount subtracted.

MinusYears(Int64)

Returns a copy of this Year with the specified number of years subtracted.

Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
Now()
Now(Clock)

Obtains the current year from the specified clock.

Now(ZoneId)

Obtains the current year from the system clock in the specified time-zone.

Of(Int32)

Obtains an instance of Year.

Parse(ICharSequence, DateTimeFormatter)

Obtains an instance of Year from a text string using a specific formatter.

Parse(ICharSequence)

Obtains an instance of Year from a text string such as 2007.

Parse(String, DateTimeFormatter)
Parse(String)
Plus(Int64, ITemporalUnit)

Returns a copy of this year with the specified amount added.

Plus(ITemporalAmount)

Returns a copy of this year with the specified amount added.

PlusYears(Int64)

Returns a copy of this Year with the specified number of years added.

Query(ITemporalQuery)

Queries this year using the specified query.

Range(ITemporalField)

Gets the range of valid values for the specified field.

SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
SetPeerReference(JniObjectReference, JniObjectReferenceOptions) (Inherited from JavaObject)
ToArray<T>()

Creates a managed array from this Java array wrapper.

(Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime()

Unregisters this Java peer from the interop runtime.

(Inherited from Object)
Until(ITemporal, ITemporalUnit)

Calculates the amount of time until another year in terms of the specified unit.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
With(ITemporalAdjuster)

Returns an adjusted copy of this year.

With(ITemporalField, Int64)

Returns a copy of this year with the specified field set to a new value.

Explicit Interface Implementations

Name Description
IComparable.CompareTo(Object)
IJavaPeerable.Disposed() (Inherited from JavaObject)
IJavaPeerable.Finalized() (Inherited from JavaObject)
IJavaPeerable.JniObjectReferenceControlBlock (Inherited from JavaObject)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from JavaObject)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from JavaObject)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from JavaObject)
IJavaPeerable.UnregisterFromRuntime()

Extension Methods

Name Description
GetJniTypeName(IJavaPeerable)

Gets the JNI name of the type of the instance self.

JavaAs<TResult>(IJavaPeerable)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
TryJavaCast<TResult>(IJavaPeerable, TResult)

Try to coerce self to type TResult, checking that the coercion is valid on the Java side.

Applies to