How to specify the format string to convert the date alone from string. In my case, only the date part is relevant
Constructing it as DateTime fails:
DateTime
You can use LocalDate.of with the year, month and day passed as separate arguments:
LocalDate.of
LocalDate date1 = LocalDate.of(2009, 4, 17); LocalDate date2 = LocalDate.of(2009, Month.APRIL, 17);