import java.time.LocalDate; public class Demo { public static void main(String[] argv) { LocalDate dateOne = LocalDate.now(); LocalDate dateTwo = LocalDate.of(dateOne.getYear(), dateOne.getMonth(), dateOne.getDayOfMonth()); System.out.printf("Date One = "+dateOne); System.out.printf("\nDate Two = "+dateTwo); if (dateOne.equals(dateTwo)) { System.out.printf("\nBoth the dates are same!", dateOne, dateTwo); } } }
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy. Accept Learn more