Java 8 – Convert ZonedDateTime to Timestamp
Java example to convert java.time.ZonedDateTime to java.sql.Timestamp and vice verse. 1. ZonedDateTime -> Timestamp TimeExample1.java package com.mkyong.jdbc; import java.sql.Timestamp; import java.time.ZonedDateTime; public class TimeExample1 { public static void main(String[] args) { ZonedDateTime now = ZonedDateTime.now(); // 1. ZonedDateTime to TimeStamp Timestamp timestamp = Timestamp.valueOf(now.toLocalDateTime()); // 2. ZonedDateTime to TimeStamp , no different Timestamp timestamp2 = …