We can use the Date.from(Instant instant) method to convert a LocalDate to a Date.
Example:
package org.code2care.examples;
import java.time.LocalDate;
import java.time.ZoneId;
import java.util.Date;
public class ExampleStringToDateJava {
public static void main(String... args) {
LocalDate localDate = LocalDate.now();
Date date = Date.from(localDate.atStartOfDay(ZoneId.systemDefault()).toInstant());
System.out.println(date);
}
}
Output:

Provide Feedback For This Article
We take your feedback seriously and use it to improve our content. Thank you for helping us serve you better!
😊 Thanks for your time, your feedback has been registered!
Comments & Discussion
Facing issues? Have questions? Post them here! We're happy to help!