Java tutorial
import java.time.LocalDateTime; import java.time.ZoneId; public class Main { public static void main(String[] args) { System.out.println(localTimeToDate(LocalDateTime.now())); } public static java.sql.Date localTimeToDate(LocalDateTime lt) { return new java.sql.Date(lt.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()); } }