Java examples for java.time:LocalDateTime
local LocalDateTime To java.sql.Timestamp
//package com.java2s; import java.sql.Timestamp; import java.time.LocalDateTime; import java.time.ZoneId; public class Main { public static Timestamp localDataTimeToTimestamp( LocalDateTime localDateTime) { return localDateTime != null ? Timestamp.from(localDateTime.atZone( ZoneId.systemDefault()).toInstant()) : null; }/* w ww.j a v a 2s .co m*/ }