JDK-8354364 : SimpleDateFormat introduces disambiguation for 12 am / 12 pm
  • Type: Enhancement
  • Component: core-libs
  • Sub-Component: java.text
  • Priority: P4
  • Status: Closed
  • Resolution: Won't Fix
  • OS: generic
  • CPU: generic
  • Submitted: 2025-04-11
  • Updated: 2025-04-14
  • Resolved: 2025-04-11
Related Reports
Relates :  
Description
ADDITIONAL SYSTEM INFORMATION :
21.0.1.12

A DESCRIPTION OF THE PROBLEM :
There is ambiguation between 12:00 am and 12:00pm in the 12 hour clock format.
Whilst Java may define this (but not in https://docs.oracle.com/en/java/javase/21/docs/api/java.base/java/text/SimpleDateFormat.html), the date may be formatted for display to non programmers.
Additionally the date format may use a server locale for formatting where a user may be used to the 24 hour clock.

As there is no such thing as 12:00:00.0000 AM (or PM) by definition noon can not be either pre or post meridiem (https://www.rmg.co.uk/stories/topics/noon-12-am-or-12-pm) this can lead to confusion for end users.

when formatting times that are either noon or midday (or would show as such because the seconds / minutes are dropped) AM/PM should be (optionally) replaced with a localaized noon/midnight.

For backwards compatability this could be done by usign a new letter for SimpleDateFormat that uses AM/PM/Noon/Midnight as appropriate.

Current workaround is to not use the core JDK feature and switch to ICU4j (https://unicode-org.github.io/icu/userguide/format_parse/datetime/#date-field-symbol-table using the `b` format)

Comments
Although we implemented "day periods" feature in date/time API, we are not planning to enhance java.text.Format for this requirement. Please use java.time API instead.
11-04-2025

Moved to JDK for further discussions.
11-04-2025