[Solved] SimpleDateFormat and not allowing it to go above 12 hours [closed]
You are experiencing SimpleDateFormat behaving as designed. It’s a behaviour that comes as a negative surprise to most. There are two solutions: the recommended one and the discouraged one. Recommended solution: LocalTime DateTimeFormatter timeFormat = DateTimeFormatter.ofPattern(“hh:mm a”, Locale.ROOT); try { LocalTime lt = LocalTime.parse(startTime, timeFormat); startTime = lt.format(timeFormat); System.out.println(startTime); } catch (DateTimeParseException e) { System.out.println(“Not … Read more