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

Improve the syntax to format fractional seconds using pattern letters

    Details

    • Type: Enhancement
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: None
    • Fix Version/s: tbd
    • Component/s: core-libs
    • Labels:
    • Subcomponent:
    • Introduced In Version:
      8
    • CPU:
      generic
    • OS:
      generic

      Description

      Need to improve the syntax to format fractional seconds using pattern letters.

      An example of the approach proposed from the CLDR development list is:

      HH:mm:ss.SSS###

      Above pattern indicates minimum 3 /up to 6 decimal digits. Advantages of this syntax include might be easier to understand(resembles number format syntax) and a little bit more flexible (can set maximum digits, not only for 9).

      We are looking to see if CLDR can add '#' for no-padding digits that may be present, in contrast to 'S', which always prints the specified number of digits by either truncating extra digits or padding zeroes.

      We also need to determine how to localize the decimal point. Predefined patterns for locales are generally not available. JSR-310 would like CLDR to do either or both of:

          Define patterns with fractional seconds with the decimal point localized to the locale
          Define a pattern letter to print the locale specific punctuation for the decimal point

      Currently, CLDR says "Certain ASCII punctuation characters may become variable in the future (for example, ":" being interpreted as the time separator and '/' as a date separator, and replaced by respective locale-sensitive characters in display)." For the second bullet, a dot '.' could work just like the way it works in number formatting.

      JSR-310 can then consider predefined formatter(s) in DateTimeFormatters and the syntax support based on the CLDR defined patterns and syntax.

      Related CLDR Ticket 5556 for Optional digits in fractional seconds pattern; http://unicode.org/cldr/trac/ticket/5556

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              rriggs Roger Riggs
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated: