webMethods

webMethods

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
Expand all | Collapse all

Weird Difference in Timezone offset for pub.date:dateTimeFormat & xsd:dateTime

  • 1.  Weird Difference in Timezone offset for pub.date:dateTimeFormat & xsd:dateTime

    Posted Wed March 08, 2006 10:33 AM

    Hi,

    I have an issue with formatting Timezone offset for XML transmission.

    pub.date:dateTimeFormat returns the timezone offset as “+0100”.

    But in the XSD for the XML to be transferred the format is required as “+01:00”.

    Is there a convenient way to format this without doing some substring/concat stuff?

    Regards,
    Holger


    #Integration-Server-and-ESB
    #webMethods
    #Flow-and-Java-services


  • 2.  RE: Weird Difference in Timezone offset for pub.date:dateTimeFormat & xsd:dateTime

    Posted Wed March 08, 2006 04:28 PM

    Holger,

    The issue stems from the difference in the way Java describes timezone offsets and the way XML Schema describes them.

    pub.date:dateTimeFormat returns the offset in Java format.

    I don’t know of a built-in way that will do this for you. I have a utility service that gets the offset, splits it into hours and minutes, adds the colon and then appends it to the XML formatted time.

    Any service that needs a time in W3C XML Schema dateTime format just calls that utility service instead of pub.date:dateTimeFormat. I also provided an optional timezone format in case it was necessary to express the XML time relative to a specific timezone.

    HTH,

    Mark


    #Integration-Server-and-ESB
    #Flow-and-Java-services
    #webMethods


  • 3.  RE: Weird Difference in Timezone offset for pub.date:dateTimeFormat & xsd:dateTime

    Posted Fri April 21, 2006 09:37 PM

    The pub.date:getCurrentDateString accepts three parameters: pattern, timezone and locale.

    If you need a numeric timezone offset in your XML schema dateTime in the format of [+|-]hh:mm you will need to start with a “pattern” of yyyy-MM-dd’T’HH:mm:ss.SSSZ and then write some extra code to insert a colon character “:” between the offset hours digits and offset minutes digits.

    If you want to use the “trailing Z” form of the XML schema dateTime, you can use the pattern yyyy-MM-dd’T’HH:mm:ss.SSS’Z’.

    Note: Be sure to use a capital “H” to represent the hours position. If you use a lower case “h” for hours, you will only be able to represent times prior to 1:00 PM correctly.

    Mark


    #webMethods
    #Integration-Server-and-ESB
    #Flow-and-Java-services


  • 4.  RE: Weird Difference in Timezone offset for pub.date:dateTimeFormat & xsd:dateTime

    Posted Mon April 24, 2006 09:40 AM

    Hi Mark,

    this is exactly the way how we implemented this transformation.

    The issue is that there is no out-of-the-box function to get the format like it is required by XML.

    Regards,
    Holger


    #webMethods
    #Flow-and-Java-services
    #Integration-Server-and-ESB