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

Long time format for Great Britain is incorrect

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: P4 P4
    • None
    • 8u45, 9
    • globalization
    • x86_64
    • linux_ubuntu

      A DESCRIPTION OF THE REQUEST :
      When formatting a "full" style date for the GB locale, the phrase "o'clock" is used erroneously.


      JUSTIFICATION :
      The phrase "o'clock" only makes sense on the hour, with a 12-hour number, such as "9 o'clock in the morning". It is not appropriate to use it when minutes or seconds are present, or with a 24-hour time.

      To fix this, the phrase "o'clock" should be removed from this format string.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      SimpleDateFormat.getTimeInstance(DateFormat.FULL, Locale.UK).format(new Date())
      > 17:25:43 BST
      ACTUAL -
      SimpleDateFormat.getTimeInstance(DateFormat.FULL, Locale.UK).format(new Date())
      > 17:25:43 o'clock BST

      ---------- BEGIN SOURCE ----------
      import java.util.*;
      import java.lang.*;
      import java.text.*;

      class BritishTime
      {
      public static void main (String[] args) throws java.lang.Exception
      {
      String result = SimpleDateFormat.getTimeInstance(DateFormat.FULL, Locale.UK).format(new Date());
      System.out.println(result);
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      Using a custom date format string instead of the FULL date style.

            naoto Naoto Sato
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: