JodaTime
To convert JodaTime’s org.joda.time.LocalDate
to java.sql.Timestamp
, just do
Timestamp timestamp = new Timestamp(localDate.toDateTimeAtStartOfDay().getMillis());
To convert JodaTime’s org.joda.time.LocalDateTime
to java.sql.Timestamp
, just do
Timestamp timestamp = new Timestamp(localDateTime.toDateTime().getMillis());
JavaTime
To convert Java8’s java.time.LocalDate
to java.sql.Timestamp
, just do
Timestamp timestamp = Timestamp.valueOf(localDate.atStartOfDay());
To convert Java8’s java.time.LocalDateTime
to java.sql.Timestamp
, just do
Timestamp timestamp = Timestamp.valueOf(localDateTime);