Failed to parse single digit hour and lowercase am-pm of day into Java 8 LocalTime

前端 未结 6 1955
借酒劲吻你
借酒劲吻你 2021-01-05 10:50

When I try to run the following code:

LocalTime test = LocalTime.parse(\"8:00am\", DateTimeFormatter.ofPattern(\"hh:mma\"));

I get this:

6条回答
  •  迷失自我
    2021-01-05 11:20

    LocalTime lt=LocalTime.parse("08:00p.m.",DateTimeFormatter.ofPattern("hh:mma"));
    

    if you put a.m. or p.m. it works but AM or PM not working. i am using openjdk 11 and openjdk 14, i think it is a bug.

提交回复
热议问题