java – How to convert a LocalDate in an instant?

The class Instant represents an instantaneous point on the timeline. Conversion to and from a LocalDate requires a time zone. Unlike other date and time libraries, the JSR-310 will not automatically select the time zone, so you need to provide it.

LocalDate date =;
Instant instant = date.atStartOfDay(ZoneId.systemDefault()).toInstant();

This example uses the JVM default time zone – ZoneId.systemDefault() – to perform the conversion. See here for a longer answer to a related question.

Update: accepted answer uses LocalDateTime::toInstant(ZoneOffset) who only accepts ZoneOffset. This answer uses LocalDate::atStartOfDay(ZoneId) that accepts any ZoneId. As such, this answer is generally most helpful (and should probably be the accepted one).

PS. I was the lead author of the API

Leave a comment