Instant Class
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
An instantaneous point on the time-line.
[Android.Runtime.Register("java/time/Instant", ApiSince=26, DoNotGenerateAcw=true)]
public sealed class Instant : Java.Lang.Object, IDisposable, Java.IO.ISerializable, Java.Lang.IComparable, Java.Time.Temporal.ITemporal, Java.Time.Temporal.ITemporalAdjuster
[<Android.Runtime.Register("java/time/Instant", ApiSince=26, DoNotGenerateAcw=true)>]
type Instant = class
inherit Object
interface ISerializable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
interface IComparable
interface ITemporal
interface ITemporalAccessor
interface ITemporalAdjuster
- Inheritance
- Attributes
- Implements
Remarks
This class models a single instantaneous point on the time-line, such as an event timestamp.
An instant stores epoch-seconds and a nanosecond-of-second. Epoch-seconds are measured from the standard Java epoch of 1970-01-01T00:00:00Z; later instants have positive values and earlier instants have negative values.
The Java Time-Scale divides each calendar day into exactly 86,400 subdivisions, known as seconds. It closely matches the civil time scale and has different definitions for different segments of the time-line.
Each Java Time-Scale segment must meet these requirements:
- The Java Time-Scale closely matches the underlying international civil time scale.:
- The Java Time-Scale exactly matches the international civil time scale at noon each day.:
- The Java Time-Scale has a precisely defined relationship to the international civil time scale.:
This value-based class treats equal instances as interchangeable. Do not use instances for synchronization; use Equals for comparisons.
Android reference for java.time.Instant.
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
| Name | Description |
|---|---|
| Class |
Returns the runtime class of this |
| Epoch |
Constant for the 1970-01-01T00:00:00Z epoch instant. |
| EpochSecond |
Gets the number of seconds from the Java epoch of 1970-01-01T00:00:00Z. |
| Handle |
The handle to the underlying Android instance. (Inherited from Object) |
| JniIdentityHashCode |
Gets the identity hash code assigned to this Java peer by the interop runtime. (Inherited from Object) |
| JniManagedPeerState | (Inherited from JavaObject) |
| JniPeerMembers | |
| Max |
The maximum supported Instant, '1000000000-12-31T23:59:59.999999999Z'. |
| Min |
The minimum supported Instant, '-1000000000-01-01T00:00Z'. |
| Nano |
Gets the number of nanoseconds, later along the time-line, from the start of the second. |
| 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) |
Methods
| Name | Description |
|---|---|
| AdjustInto(ITemporal) |
Adjusts the specified temporal object to have this instant. |
| AtOffset(ZoneOffset) |
Combines this instant with an offset to create an OffsetDateTime. |
| AtZone(ZoneId) |
Combines this instant with a time-zone to create a ZonedDateTime. |
| Clone() |
Creates and returns a copy of this object. (Inherited from Object) |
| CompareTo(Instant) |
Compares this instant to the specified instant. |
| 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) |
| From(ITemporalAccessor) |
Obtains an instance of Instant from a temporal object. |
| Get(ITemporalField) |
Gets the value of the specified field from this instant 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 instant as a long. |
| IsAfter(Instant) |
Checks if this instant is after the specified instant. |
| IsBefore(Instant) |
Checks if this instant is before the specified instant. |
| IsSupported(ITemporalField) |
Checks if the specified field is supported. |
| IsSupported(ITemporalUnit) |
Checks if the specified unit is supported. |
| 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) |
| Minus(Int64, ITemporalUnit) |
Returns a copy of this instant with the specified amount subtracted. |
| Minus(ITemporalAmount) |
Returns a copy of this instant with the specified amount subtracted. |
| MinusMillis(Int64) |
Returns a copy of this instant with the specified duration in milliseconds subtracted. |
| MinusNanos(Int64) |
Returns a copy of this instant with the specified duration in nanoseconds subtracted. |
| MinusSeconds(Int64) |
Returns a copy of this instant with the specified duration in seconds 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() |
Obtains the current instant from the system clock. |
| Now(Clock) |
Obtains the current instant from the specified clock. |
| OfEpochMilli(Int64) |
Obtains an instance of Instant using milliseconds from the epoch of 1970-01-01T00:00:00Z. |
| OfEpochSecond(Int64, Int64) |
Obtains an instance of Instant using seconds from the epoch of 1970-01-01T00:00:00Z and nanosecond fraction of second. |
| OfEpochSecond(Int64) |
Obtains an instance of Instant using seconds from the epoch of 1970-01-01T00:00:00Z. |
| Parse(ICharSequence) |
Obtains an instance of Instant from a text string such as 2007-12-03T10:15:30.00Z. |
| Parse(String) |
Obtains an instance of Instant from a text string such as 2007-12-03T10:15:30.00Z. |
| Plus(Int64, ITemporalUnit) |
Returns a copy of this instant with the specified amount added. |
| Plus(ITemporalAmount) |
Returns a copy of this instant with the specified amount added. |
| PlusMillis(Int64) |
Returns a copy of this instant with the specified duration in milliseconds added. |
| PlusNanos(Int64) |
Returns a copy of this instant with the specified duration in nanoseconds added. |
| PlusSeconds(Int64) |
Returns a copy of this instant with the specified duration in seconds added. |
| Query(ITemporalQuery) |
Queries this instant 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) |
| ToEpochMilli() |
Converts this instant to the number of milliseconds from the epoch of 1970-01-01T00:00:00Z. |
| ToString() |
Returns a string representation of the object. (Inherited from Object) |
| TruncatedTo(ITemporalUnit) |
Returns a copy of this Instant truncated to the specified unit. |
| UnregisterFromRuntime() |
Unregisters this Java peer from the interop runtime. (Inherited from Object) |
| Until(ITemporal, ITemporalUnit) |
Calculates the amount of time until another instant 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 instant. |
| With(ITemporalField, Int64) |
Returns a copy of this instant 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 |
| JavaAs<TResult>(IJavaPeerable) |
Try to coerce |
| JavaCast<TResult>(IJavaObject) |
Performs an Android runtime-checked type conversion. |
| JavaCast<TResult>(IJavaObject) | |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
Try to coerce |