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