If I give the input as any date format.I want to convert it into YYYY-MM-DD HH:MM:SS
I wrote the code as:
The input format will be any of them below:
DateTimeFormatter inputformats=DateTimeFormatter.ofPattern("[dd-MMM-uuuu hh:mm]","[dd-MMM-uuuu hh:mm:ss.s]","[uuuu-MM-dd hh:mm:ss]","[dd-MM-uuuu hh:mm:ss]""[uuuu-MM-dd]").withResolverStyle(ResolverStyle.STRICT);
try {
LocalDateTime localDate = LocalDateTime.parse(value, inputformats);
value = localDateTime.format(outputformat);
return value;
} catch (DateTimeParseException e) {
log.error(e);
return null;
}
And I give the input as:"26-08-1990 10:12:11". But I am getting the "could not be parsed: unable to obtain localDateTime from temporalaccessor" this error