使用 Joda 时间将 12 小时制转换为 24 小时制
Convert 12 hour time to 24 hour using Joda time
我收到这个错误
格式无效:“09:30 PM”在“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());
您的模式不正确。请使用以下内容:
DateTimeFormatter formatter= DateTimeFormat.forPattern("hh:mm aa");
编辑:这是 link 到 Documentation for DateTimeFormat。
我收到这个错误 格式无效:“09:30 PM”在“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());
您的模式不正确。请使用以下内容:
DateTimeFormatter formatter= DateTimeFormat.forPattern("hh:mm aa");
编辑:这是 link 到 Documentation for DateTimeFormat。