I'm trying to parse data coming from MySql in the following format:
DATE_FORMAT(datetime,'%m-%d-%Y %H:%i')
Java parser code looks like this:
ZonedDateTime datetime = ZonedDateTime
.parse(
row[1].toString(),
DateTimeFormatter
.ofPattern("MM-dd-YYYY hh:mm")
.withZone(ZoneId.of("Etc/GMT"))
);
Exception in thread "AWT-EventQueue-0" java.time.format.DateTimeParseException: Text '06-08-2017 04:15' could not be parsed: Unable to obtain ZonedDateTime from TemporalAccessor: {MinuteOfHour=15, DayOfMonth=8, WeekBasedYear[WeekFields[SUNDAY,1]]=2017, MonthOfYear=6, HourOfAmPm=4},ISO,Etc/GMT of type java.time.format.Parsed
Is there a better/shorter way to get this done?