Convert LocalDateTime to LocalDate in Java

This example shows how to convert LocalDateTime to LocalDate instance with an example.

Convert LocalDateTime to LocalDate Example

LocalDateTime class provides below API to convert from LocalDateTime to LocalDate in Java.
  • LocalDate toLocalDate() - Gets the LocalDate part of this date-time.
import java.time.LocalDate;
import java.time.LocalDateTime;

 * Program to demonstrate LocalDateTime Class APIs.
 * @author
public class LocalDateTimeExample {

    public static void main(String[] args) {

    private static void convertLocalDateTimeToLocalDate() {
        LocalDateTime dateTime =;

        LocalDate localDate = dateTime.toLocalDate();
To convert LocalDateTime to LocalDate instance, use toLocalDate() method. It returns a LocalDate with the same year, month and day as given date-time.

Free Spring Boot Tutorial - 5 Hours Full Course

Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course