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



Follow us on Facebook and Twitter for latest update.