나는 많은 솔루션을 온라인으로 확인했지만 "hh : mm a"를 구문 분석 할 때 여전히 예외가 발생합니다. JSP에서DateTimeFormatter "hh : mm a"의 구문 분석 시간이 예외
: 자바에서
$('#t2').timepicker({
timeFormat : 'hh:mm a',
interval : 30,
maxTime : '11:00 pm',
startTime : '08:00 am',
dynamic : false,
dropdown : true,
scrollbar : true
});
...
<div class="form-group">
<label
class="col-md-3 control-label">Start
Time</label>
<div class="col-md-7">
<input type="text"
class="timepicker"
id="t1"
name="startTime"
readonly="readonly">
</div>
</div>
:
String startTime = request.getParameter("startTime");
DateTimeFormatter formatterTime1 = DateTimeFormatter.ofPattern("hh:mm a", Locale.US);
LocalDateTime localStartTime = LocalDateTime.parse(startTime, formatterTime1);
예외 :
java.time.format.DateTimeParseException: Text '08:00 am' could not be parsed at index 6
내가 하드 코딩하려해도 :
String startTime = "08:00 am" (08:00am, 8:00am);
같은 문제가 있습니다. 단일 테스트 파일에서도. Java 8에서 String 만 구문 분석 할 수 없기 때문에 그렇습니까?