The Instant class represents an instantaneous point on the time-line. Conversion to and from a LocalDate requires a time-zone. Unlike some other date and time libraries, JSR-310 will not select the time-zone for you automatically, so you must provide it.
LocalDate date = LocalDate.now();
Instant instant = date.atStartOfDay(ZoneId.systemDefault()).toInstant();
This example uses the default time-zone of the JVM - ZoneId.systemDefault() - to perform the conversion. See here for a longer answer to a related question.
Update: The accepted answer uses LocalDateTime::toInstant(ZoneOffset) which only accepts ZoneOffset. This answer uses LocalDate::atStartOfDay(ZoneId) which accepts any ZoneId. As such, this answer is generally more useful (and probably should be the accepted one).
PS. I was the main author of the API
Answer from JodaStephen on Stack OverflowThe Instant class represents an instantaneous point on the time-line. Conversion to and from a LocalDate requires a time-zone. Unlike some other date and time libraries, JSR-310 will not select the time-zone for you automatically, so you must provide it.
LocalDate date = LocalDate.now();
Instant instant = date.atStartOfDay(ZoneId.systemDefault()).toInstant();
This example uses the default time-zone of the JVM - ZoneId.systemDefault() - to perform the conversion. See here for a longer answer to a related question.
Update: The accepted answer uses LocalDateTime::toInstant(ZoneOffset) which only accepts ZoneOffset. This answer uses LocalDate::atStartOfDay(ZoneId) which accepts any ZoneId. As such, this answer is generally more useful (and probably should be the accepted one).
PS. I was the main author of the API
In order to convert it to an instant you need to have a LocalDateTime instance, e.g.:
LocalDate.now().atStartOfDay().toInstant(ZoneOffset.UTC)
Java 9+
LocalDate.ofInstant(...) arrived in Java 9.
Instant instant = Instant.parse("2020-01-23T00:00:00Z");
ZoneId zone = ZoneId.of("America/Edmonton");
LocalDate date = LocalDate.ofInstant(instant, zone);
See code run live at IdeOne.com.
Notice the date is 22nd rather than 23rd as that time zone uses an offset several hours before UTC.
2020-01-22
Java 8
If you are using Java 8, then you could use ZonedDateTime's toLocalDate() method:
yourInstant.atZone(yourZoneId).toLocalDate()
Other answers provided the mechanics for the transformation, but I wanted to add some background on the meaning of such transformation which hopefully helps explain why it works the way it works.
LocalDate and Instant seem similar – they both hold date(/time) information without the time zone information. However, they have quite a different meaning.
Instant represents a point in time unambiguously. The representation does not explicitly contain any time zone, but implicitly it refers to the UTC time line.
LocalDateTime (and LocalDate) is ambiguous, because it represents a point in the local timeline, which implicitly refers to the local time zone.
So, in order to correctly transform an Instant into a LocalDateTime (conceptually – some of these steps are bundled together into a single operation in the implementation) you need to:
1. convert the Instant into a ZonedDateTime by applying the UTC time zone info
2. change the time zone from UTC to the local time zone (which implies applying the relevant time zone offset) which gives you another ZonedDateTime (with different time zone)
3. convert the ZonedDateTime into a LocalDateTime which makes the time zone implicit (local) by removing the time zone info.
Finally, you can drop the time-part of LocalDateTime and end up with the LocalDate.