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

前端 未结 6 1953
借酒劲吻你
借酒劲吻你 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:21

    Just a heads up, In Adelaide the requirement is for it to use am insteam of AM, so I am having to .toLowerCase() my dates prior to parsing from text. So "AM" fails, "am" works.

提交回复
热议问题