In a need to convert Java LocalDate
of the format of dd-MM-yyyy
into a LocalDate
of dd/MM/yyyy
.
Trying with :
DateTimeFormatter dateFormat = DateTimeFormatter.ofPattern("dd/MM/yyyy");
LocalDate date = // LocalDate value in dd-MM-yyyy format
String stringDate = dateFormat.format(date);
LocalDate convertedDate = LocalDate.parse(stringDate, dateFormat);
But still it resulting into return a date in dd-MM-yyyy
format. Any efficient way to do this?