Uploaded image for project: 'Commons Lang'
  1. Commons Lang
  2. LANG-1638

Update Date Javadocs regarding week year support

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • 3.11
    • 3.13.0
    • None
    • None
    • Production

    Description

      December 27th to 31st 2020 gets converted into 2021 while trying to use 

      `DateFormatUtils.format` method. 

      import org.apache.commons.lang3.time.DateFormatUtils;
      import org.apache.commons.lang3.time.DateUtils;
      
      public class DateEx {
      
          public static void main(String... args) throws Exception{
      
              String startDateStr = "2020-12-31";
      
      
              String startDate = DateFormatUtils
                      .format(DateUtils.parseDate(startDateStr, "YYYY-MM-dd"), "YYYY-MM-dd-HH.MM.SS.mmmmmm");
              System.out.println("startDate with Timestamp - " + startDate);
      
          }
      }
      

       

      Actual Output -  2021-12-31-00.12.00.000000

      Expected Output - 2020-12-31-00.12.00.000000

       

      Can someone look into it.

       

      Version :-

      1. Java -> 1.8.0_212-b10
      2. Common-lang3 -> 3.11

       

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            shailenda.soni Shailendra Soni
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - Not Specified
                Not Specified
                Remaining:
                Remaining Estimate - 0h
                0h
                Logged:
                Time Spent - 1h 10m
                1h 10m