Convert Java Instant to Date [2021]
In this tutorial, We will Convert Java Instant to Date using Date.from(Instant instant) method.
Java Instant to Date Example
This example shows how to convert Java Instant to Date using Date.from(Instant instant) method.
import java.time.Instant;
import java.util.Date;
public class JavaInstantNowToDate {
public static void main(String[] args) {
Instant instant = Instant.now();
System.out.println("Instant : " + instant);
// Java Instant now to Date
Date date = Date.from(instant);
System.out.println("Java Instant to Date : " + date);
}
}
Output:
Instant : 2021-06-29T16:36:19.769Z
Java Instant to Date : Tue Jun 29 16:36:19 IST 2021
Conclusion
In this tutorial, we have covered how to convert Java Instant to Date using the Date class static method Date.from(Instant instant).
Thanks for reading this tutorial so far. If you like this tutorial then please share it with your friends and colleagues. If you have any questions, doubts, suggestions, or feedback then please drop a comment and I'll try to answer your question.
Happy Learning!!!
More Examples you may like
Comments
Post a Comment
If you have any doubts, Please let me know.