Java tutorial
import java.sql.Timestamp; import java.time.ZonedDateTime; public class Main { public static void main(String[] args) { System.out.println(toTimestamp(ZonedDateTime.now())); } public static Timestamp toTimestamp(ZonedDateTime dateTime) { return new Timestamp(dateTime.toInstant().getEpochSecond() * 1000L); } }