Here you can find the source of asLocalDateTime(Date date)
public static LocalDateTime asLocalDateTime(Date date)
//package com.java2s; //License from project: Apache License import java.time.*; import java.util.Date; public class Main { /**/*from www . j a va2s. c o m*/ * Calls {@link #asLocalDateTime(Date, ZoneId)} with the system default time zone. */ public static LocalDateTime asLocalDateTime(Date date) { return asLocalDateTime(date, ZoneId.systemDefault()); } /** * Creates {@link LocalDateTime} from {@code java.util.Date} or it's subclasses. Null-safe. */ public static LocalDateTime asLocalDateTime(Date date, ZoneId zone) { if (date == null) return null; if (date instanceof java.sql.Timestamp) return ((java.sql.Timestamp) date).toLocalDateTime(); else return Instant.ofEpochMilli(date.getTime()).atZone(zone).toLocalDateTime(); } }