java – Convert Java.time.LocalDate to Java.util.Date type

Java.time has the temporal interface that you can use to create instant objects from most of the temporal classes. Instant represents milliseconds on the timeline in Epoch – the base reference for all other dates and times.

We need to convert the date to a ZonedDateTime, with a time and a zone, to do the conversion:

LocalDate ldate = ...;
Instant instant = Instant.from(ldate.atStartOfDay(ZoneId.of("GMT")));
Date date = Date.from(instant);

Leave a comment