Java examples for java.time:LocalDateTime
Convert Date to LocalDateTime of Java 8
//package com.java2s; import java.time.LocalDateTime; import java.time.ZoneId; import java.util.Date; public class Main { /**/*from w w w. j av a 2 s . c o m*/ * Convert Date to LocalDateTime of Java8 * @param date * @return */ public static Date toDate(LocalDateTime localDateTime) { if (localDateTime == null) return null; return Date.from(localDateTime.atZone(ZoneId.systemDefault()) .toInstant()); } }