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

After version 3.4 DateFormatUtils has a bug: Use TimeZone from Calendar in DateFormatUtils.

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Critical
    • Resolution: Fixed
    • 3.5, 3.6, 3.7, 3.8, 3.9, 3.8.1
    • 3.13.0
    • lang.time.*
    • None

    Description

      The code is as follows :

      Calendar cale = Calendar.getInstance();
      System.out.println("Old time is " + DateFormatUtils.format(cale, "yyyyMMddHHmmss"));
      cale.setTimeZone(TimeZone.getTimeZone("JST"));
      System.out.println("New time is " + DateFormatUtils.format(cale, "yyyyMMddHHmmss"));

       

      The results of commons-lang3 3.4:

      Old time is 20190605144536
      New time is 20190605154536

       

      The results of the version after commons-lang3 3.4:

      Old time is 20190605144536
      New time is 20190605144536

       

      We found that the time zone setting was invalidated when it was formatted

       

      Attachments

        Activity

          People

            Unassigned Unassigned
            elunlng Lijun Liang
            Votes:
            0 Vote for this issue
            Watchers:
            8 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 20m
                1h 20m