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

Problem with timezone in a SimpleDateFormat

XMLWordPrintable

    • b25
    • generic
    • generic
    • Verified

        SHORT SUMMARY: Inaccurate date reports when using yyyy/MM/dd HH:mm:ss.S z
        date format on a Timezone with historical TZ rules
        INDICATORS: Can occur when parsing date strings with TimeZone included, the
        "z" element.
        COUNTER INDICATORS:
        TRIGGERS:
        SimpleDateFormat class can incorrectly calculate a DST offset when parsing
        date strings that contain the TimeZone. If the parsed TZ has used different
        rules over past years, then the hour offset from the DST calculation may be
        incorrect. In general, applications shouldn't rely on time zone abbreviations
        for parsing of date strings. e.g CST can represent different timezones across
        the globe.

        KNOWN WORKAROUND: Don't use timezone abbreviations in timezones strings that
        are to be parsed. Perhaps store the timezone separately.
        PRESENT SINCE: N/A
        HOW TO VERIFY:
        NOTES FOR SE: Dev engineer has proposed some changes to correct this. It
        should first be ported to JDK 8 and baked/tested there for compatibility
        behaviour. Once satisfied, we can port it to a JDK 6 update release.

        REGRESSION:

              okutsu Masayoshi Okutsu
              shadowbug Shadow Bug
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: