We would like to know how to convert Date to Instant.
/* w w w .j a va 2 s .c o m*/ import java.time.Instant; import java.util.Date; public class Main { public static void main(String[] args) { // Date to Instant Instant timestamp = new Date().toInstant(); System.out.println(timestamp); } }
The code above generates the following result.