Here you can find the source of toInstant(Date date)
public static Instant toInstant(Date date)
//package com.java2s; //License from project: Open Source License import java.time.Instant; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Date; public class Main { public static Instant toInstant(Date date) { if (date == null) { return null; }/* www .ja v a 2 s. co m*/ Instant moment = Instant.ofEpochMilli(date.getTime()); return moment; } public static Instant toInstant(LocalDateTime localDateTime) { if (localDateTime == null) { return null; } Instant moment = localDateTime.atZone(ZoneId.systemDefault()).toInstant(); return moment; } }