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

FastDateFormat does not support timezone X/XX/XXX in SimpleDateFormat

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Cannot Reproduce
    • 3.3.2
    • None
    • lang.time.*
    • None

    Description

      It sees FastDateFormat does not support timezone X/XX/XXX in SimpleDateFormat.

      For example,

      FastDateFormat.getInstance("yyyy-MM-dd'T'HH:mm:ss.SSSXXX")
      

      throws an exception as below:

      Illegal pattern component: XXX
      java.lang.IllegalArgumentException: Illegal pattern component: XXX
      	at org.apache.commons.lang3.time.FastDatePrinter.parsePattern(FastDatePrinter.java:282)
      	at org.apache.commons.lang3.time.FastDatePrinter.init(FastDatePrinter.java:149)
      	at org.apache.commons.lang3.time.FastDatePrinter.<init>(FastDatePrinter.java:142)
      

      X/XX/XXX are different with Z or ZZ as described in https://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html#iso8601timezone

      It supports to read all +0800, +08 and +08:00 whereas it seems there is no way to include those all.

      I looked though the documentation multiple times but I could not find the explicit mention about this.

      Attachments

        Activity

          People

            Unassigned Unassigned
            gurwls223 Hyukjin Kwon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: