We would like to know how to convert LocalDateTime to LocalDate, remove the time part.
import java.time.LocalDate; import java.time.LocalDateTime; /* w ww . j a v a 2 s. c o m*/ public class Main { public static void main(String[] args) { System.out.println(getDatePart(LocalDateTime.now())); } public static LocalDate getDatePart(final LocalDateTime dateTime) { return dateTime.toLocalDate(); } }
The code above generates the following result.