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

[Fmt-Da] RFE: support xsd:dateTime format parsing + formatting from java.text.SimpleDateFormat

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 5.0
    • core-libs

      A DESCRIPTION OF THE REQUEST :
      The xsd:dateTime can carry several formats, among them
      2005-10-20T22:22:22+01:00
      2005-10-20T22:22:22Z
      (cf http://books.xmlschemata.org/relaxng/ch19-77049.html)

      These formats cannot be produced or parsed from within SimpleDateFormat, because
      "z" will parse/produce "GMT-08:00" (the "GMT is too much) and "Z" will parse/produce
      "-0800" (missing ":").


      JUSTIFICATION :
      Looking at the various SOAP implementations out there, all of them use different
      SimpleDateFormat strings in combination with String arithmetics, substring, substituting etc. Bugs and incompatibilities are to be expected.
      Really, this is quite a basic thing and should be handled within the API.
      Lots of people with similar thoughts (and problems) can be found in any forum.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Either a)
      SimpleDateFormat has some new formatting tokens that correspond to the xsd:dateTime
      part or
      b) a new XSDDateFormat is implemented in java.text.*
      ACTUAL -
      There is no easy, consistent and safe way in the API to have this done.

      CUSTOMER SUBMITTED WORKAROUND :
      set timezone to GMT, then output timezone part with "z" and perform some modification,
      like, replace "+00:00" with "Z", and remove the "GMT" part from the result

            okutsu Masayoshi Okutsu
            gmanwanisunw Girish Manwani (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: