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

java.time.DateTimeFormatter javadoc: F is not week-of-month

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 8, 9
    • Fix Version/s: 9
    • Component/s: core-libs
    • Subcomponent:
    • Resolved In Build:
      b152

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_102"
      Java(TM) SE Runtime Environment (build 1.8.0_102-b14)
      Java HotSpot(TM) 64-Bit Server VM (build 25.102-b14, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      not relevant

      EXTRA RELEVANT SYSTEM CONFIGURATION :
      not relevant

      A DESCRIPTION OF THE PROBLEM :
      The javadoc of DateTimeFormatter describes:

        Symbol Meaning Presentation Examples
        ------ ------- ------------ -------
         F week-of-month number 3

      But F is the aligned day of week in month, not the week-of-month.

      Related: http://stackoverflow.com/a/40423047/829571


      REPRODUCIBILITY :
      This bug can be reproduced always.

        Activity

        Hide
        aroy Abhijit Roy (Inactive) added a comment - - edited
        package com.oracle.java.clientlibs;

        import java.time.LocalDate;
        import java.time.Month;
        import java.time.format.DateTimeFormatter;
        import java.time.temporal.Temporal;


        public class Test123 {

          public static void main(String[] args) {
            LocalDate ld = LocalDate.of(2016, Month.NOVEMBER, 30);
           
            format(ld, "dd MMM YYYY");
            format(ld, "EEEE");
            //F meant for Day of week in month
            format(ld, "F");
            //W meant for Week of month
            format(ld, "W");
          }

          public static void format(Temporal co, String pattern) {
            DateTimeFormatter fmt = DateTimeFormatter.ofPattern(pattern);
            String str = fmt.format(co);
            System.out.println(pattern + ": " + str);
          }
        }

        ===================================================================
        O/P:
        dd MMM YYYY: 30 Nov 2016
        EEEE: Wednesday
        F: 2
        W: 5


        =============================================================================
        As per JKD 8,9 api,
        http://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns
        http://download.java.net/java/jdk9/docs/api/java/time/format/DateTimeFormatter.html#patterns

         Symbol___Meaning_______Presentation _ Examples
        ===========================================
         W----------week-of-month---------number-----------4
           
         F----------week-of-month---------number------------3

        =================================================================================
        For symbol "F", it should be "Day of week in month"
        Show
        aroy Abhijit Roy (Inactive) added a comment - - edited package com.oracle.java.clientlibs; import java.time.LocalDate; import java.time.Month; import java.time.format.DateTimeFormatter; import java.time.temporal.Temporal; public class Test123 {   public static void main(String[] args) {     LocalDate ld = LocalDate.of(2016, Month.NOVEMBER, 30);         format(ld, "dd MMM YYYY");     format(ld, "EEEE");     //F meant for Day of week in month     format(ld, "F");     //W meant for Week of month     format(ld, "W");   }   public static void format(Temporal co, String pattern) {     DateTimeFormatter fmt = DateTimeFormatter.ofPattern(pattern);     String str = fmt.format(co);     System.out.println(pattern + ": " + str);   } } =================================================================== O/P: dd MMM YYYY: 30 Nov 2016 EEEE: Wednesday F: 2 W: 5 ============================================================================= As per JKD 8,9 api, http://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html#patterns http://download.java.net/java/jdk9/docs/api/java/time/format/DateTimeFormatter.html#patterns  Symbol___Meaning_______Presentation _ Examples ===========================================  W----------week-of-month---------number-----------4      F----------week-of-month---------number------------3 ================================================================================= For symbol "F", it should be "Day of week in month"
        Hide
        hgupdate HG Updates added a comment -
        URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/fcd504fb37bf
        User: rriggs
        Date: 2017-01-05 20:58:02 +0000
        Show
        hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/dev/jdk/rev/fcd504fb37bf User: rriggs Date: 2017-01-05 20:58:02 +0000
        Hide
        hgupdate HG Updates added a comment -
        URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/fcd504fb37bf
        User: lana
        Date: 2017-01-11 20:48:03 +0000
        Show
        hgupdate HG Updates added a comment - URL: http://hg.openjdk.java.net/jdk9/jdk9/jdk/rev/fcd504fb37bf User: lana Date: 2017-01-11 20:48:03 +0000

          People

          • Assignee:
            aroy Abhijit Roy (Inactive)
            Reporter:
            webbuggrp Webbug Group
          • Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: