Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

DateTimeFormatter am/pm java 9 case changed

e9039c51-3020-4140-ac24-51566819af0fSep 3 2017 — edited Aug 14 2018

Hi

When testing java 9+181 I encountered an issue with one of our tests

There's a change in behaviour for DateTimeFormatter with the pattern 'a' argument

Test case:

String formattedDate = DateTimeFormatter.ofPattern("a").format(LocalDateTime.now());
System.out.println(formattedDate);

assertThat(formattedDate).isEqualTo("PM");

Passed on java 8

Fails on java 9 with: 'pm'

Is this an intentional change?

The javadocs still say PM

DateTimeFormatter (Java SE 9 & JDK 9 )

Comments
Post Details
Added on Sep 3 2017
1 comment
913 views