The from(Instant inst) method of Java Date class returns an instance of date which is obtained from an Instant object.
public static Date from(Instant inst)
Parameters: The method takes one parameter inst of Instant type which is required to be converted.
Return Value: The method returns a date representing the same point on the timeline as the passing instant.
- NullPointerException: This is thrown when the instant is left null.
- IllegalArgumentException: This is thrown when the instant is too large to be represented as a Date.
Below programs illustrate the use of from() Method in Java:
Present: Tue Mar 26 06:45:40 UTC 2019
Date: Wed Jan 30 06:45:43 UTC 2019
- Date before() method in Java with Examples
- Date hashCode() method in Java with Examples
- Date toInstant() Method in Java with Examples
- Date compareTo() method in Java with examples
- Date clone() method in Java with Examples
- Date equals() method in Java with Examples
- Date setTime() method in Java with Examples
- Date toString() method in Java with Examples
- Date getTime() method in Java with Examples
- Date class in Java (With Examples)
- util.date class methods in Java with Examples
- Date after() method in Java
- DateFormat format(Date obj) method in Java
- Java.util.Collections.disjoint() Method in java with Examples
- Java lang.Long.highestOneBit() method in Java with Examples
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.