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

SimpleDateFormat shouldn't use decimals

XMLWordPrintable

    • 1.1.6
    • x86
    • windows_nt
    • Verified



        Name: paC48320 Date: 10/16/97


        SimpleDateFormat uses the default number format for a given locale to format any
        numbers it had to format. If the default number pattern for a particular locale
        has required digits after the decimal point (e.g., "#,##0.00" instead of "#,##0.##"),
        all the numbers produced by the DateFormat will have these decimal places, leading
        bizarre results.

        Right now, lt_LT (Lithuanian) has this problem. The following code:

        DateFormat formatter = DateFormat.getTimeInstance(DateFormat.MEDIUM, new Locale("lt", "LT", ""));
        System.out.println(formatter.format(new Date(1997, 10, 14, 10, 15, 31));

        will produce

        10,00.15,00.31,00

        instead of

        10.15.31
        ======================================================================

              joconnersunw John Oconner (Inactive)
              pallenba Peter Allenbach (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: