In Java 8, how can I convert a Timestamp
(in java.sql
) to a LocalDate
(in java.time
)?
You can do:
timeStamp.toLocalDateTime().toLocalDate();
Note that
timestamp.toLocalDateTime()
will use theClock.systemDefaultZone()
time zone to make the conversion. This may or may not be what you want.