Java examples for java.sql:Time
Convert a LocalDate value to a java.sql.TimeStamp value
//package com.java2s; import java.sql.Timestamp; import java.time.LocalDate; import java.time.ZoneId; import java.util.Date; public class Main { /**/*from w w w . j av a 2s . c o m*/ * Convert a LocalDate value to a TimeStamp value * @param localDate * @return a TimeStamp value */ public static Timestamp toTimestamp(LocalDate localDate) { Date date = Date.from(localDate.atStartOfDay() .atZone(ZoneId.systemDefault()).toInstant()); Timestamp timeStamp = new Timestamp(date.getTime()); return timeStamp; } }