Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8148947

DateTimeFormatter pattern letter 'g'


    • Type: Enhancement
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Resolved In Build:


      The CLDR specification includes pattern letter 'g'.

      "Modified Julian day. This is different from the conventional Julian day number in two regards. First, it demarcates days at local zone midnight, rather than noon GMT. Second, it is a local number; that is, it depends on the local time zone. It can be thought of as a single number that encompasses all the date-related fields."

      This definition matches the field `JulianFields.MODIFIED_JULIAN_DAY` thus adding it as a new pattern will be easy.

      The documentation of `DateTimeFormatter` must have an additional line added (after "d"). The documentation of `DateTimeFormatterBuilder.appendPattern` must have an additional line added (after "F"). The private method `parseField` must have a new case statement added for "g". The private FIELD_MAP must be updated and the "LDML - g" comment line removed.

      The field should use `appendValue(JulianFields.,MODIFIED_JULIAN_DAY n, 19, SignStyle.NORMAL)` where n is the number of pattern letters.

      While making this change, the method documentation of `DateTimeFormatterBuilder.appendPattern` should have the semicolons removed from the end of each line in the table.


        No work has yet been logged on this issue.


          • Assignee:
            ntv Nadeesh Tv
            scolebourne Stephen Colebourne
          • Votes:
            0 Vote for this issue
            3 Start watching this issue


            • Created: