w3resource

Java Date.from() Method

public static Date from(Instant instant)

The from() method is used to obtain 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.

Package: java.util

Java Platform: Java SE 8

Syntax:

from(Instant instant)

Parameters:

Name Description
instant the instant to convert

Return Value:
A Date representing the same point on the time-line as the provided instant.

Return Value Type: boolean

Java Code Editor:

Previous:equals Method
Next:getTime Method



Become a Patron!

Follow us on Facebook and Twitter for latest update.

It will be nice if you may share this link in any developer community or anywhere else, from where other developers may find this content. Thanks.

https://w3resource.com/java-tutorial/util/date/java_date_from.php