2

I am getting this error Invalid format: "09:30 PM" is malformed at " PM"

LocalTime start = new LocalTime();
LocalTime end = new LocalTime();
DateTimeFormatter formatter = DateTimeFormat.forPattern("hh:mm a");
start = formatter.parseLocalTime(from.toLowerCase());
end = formatter.parseLocalTime(to.toLowerCase());
SillySam
  • 98
  • 7
Swanand Keskar
  • 1,023
  • 1
  • 13
  • 27

1 Answers1

3

Your Pattern is incorrect. Please use the following:

DateTimeFormatter formatter= DateTimeFormat.forPattern("hh:mm aa");

Edit: Here is a link to the Documentation for DateTimeFormat.

dipdipdip
  • 2,326
  • 1
  • 21
  • 31