I wanted to convert my string to LocalTime format
String s = "1時30分:00";
String ss = s.replace("時", ":").replace("分", ":");
DateTimeFormatter timeColonFormatter = new DateTimeFormatterBuilder().parseCaseInsensitive().appendPattern("hh:mm a").toFormatter(Locale.JAPAN);
System.out.println(timeColonFormatter);
LocalTime colonTime = LocalTime.parse("3:30 am", timeColonFormatter);
System.out.println(colonTime);
I received error:
Exception in thread "main" java.time.format.DateTimeParseException: Text '3:30 ' could not be parsed at index 0
Expected output:
3:30 AM