Condividi tramite


Date.From(Instant) Method

Definition

Obtains an instance of Date from an Instant object.

[Android.Runtime.Register("from", "(Ljava/time/Instant;)Ljava/util/Date;", "", ApiSince=26)]
public static Java.Util.Date? From (Java.Time.Instant? instant);
[<Android.Runtime.Register("from", "(Ljava/time/Instant;)Ljava/util/Date;", "", ApiSince=26)>]
static member From : Java.Time.Instant -> Java.Util.Date

Parameters

instant
Instant

the instant to convert

Returns

a Date representing the same point on the time-line as the provided instant

Attributes

Remarks

Obtains an instance of Date from an Instant object.

Instant uses a precision of nanoseconds, whereas Date uses a precision of milliseconds. The conversion will truncate any excess precision information as though the amount in nanoseconds was subject to integer division by one million.

Instant can store points on the time-line further in the future and further in the past than Date. In this scenario, this method will throw an exception.

Added in 1.8.

Java documentation for java.util.Date.from(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.

Applies to