Java tutorial
import java.sql.ResultSet; import java.sql.SQLException; import java.sql.Timestamp; import java.time.Instant; import java.time.ZoneOffset; import java.time.ZonedDateTime; public class Main { public static void main(String[] args) { } public static ZonedDateTime fromTimestamp(ResultSet rs, String column) throws SQLException { Timestamp timestamp = rs.getTimestamp(column); return getDateTime(timestamp); } public static ZonedDateTime getDateTime(Timestamp timestamp) { return timestamp != null ? ZonedDateTime.ofInstant(Instant.ofEpochMilli(timestamp.getTime()), ZoneOffset.UTC) : null; } }