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
  • 1.  How to convert timezone in ESB service

    Posted Mon March 11, 2019 10:32 AM

    Hi ,

    I have input date as 2019-03-01T19:48:17 and i have to convert into other timezone EST
    Vendor told us above date is coming as UTC.
    I have used inbuilt service pub.date:dateTimeFormat

    I have given input pattern a s: yyyy-MM-dd’T’HH:mm:ss
    new pattern as : MM/dd/yyyy HH:mm:ss z

    but this is not helpful.
    How to convert new pattern into EST timezone format.

    Thanks
    Sushant


    #webMethods
    #Integration-Server-and-ESB


  • 2.  RE: How to convert timezone in ESB service

    Posted Mon March 11, 2019 12:28 PM

    Hi Sushant,

    please add a fixed Char ‘Z’ to your timestamp and your input pattern.
    This indicates that the timestamp is in UTC.

    Please note that the TimeZone Abbreviations are not unique around the world, there might be several timezones using the same abbreviation, but have different offsets. So better work directly with the numeric offsets or point the service to use the local offset defined in the OS.

    You can try to use a Java Service for conversion (see Oracle´s JavaAPI doc for details).

    Regards,
    Holger


    #webMethods
    #Integration-Server-and-ESB


  • 3.  RE: How to convert timezone in ESB service

    Posted Mon March 11, 2019 12:58 PM

    Hi ,

    Is it possible to convert input datetime into EST datetime without using Java Service.

    Thanks
    Sushant


    #webMethods
    #Integration-Server-and-ESB


  • 4.  RE: How to convert timezone in ESB service

    Posted Tue March 12, 2019 06:43 AM

    Hi,

    pub.date:formatDate might be useful here.

    Best regards,


    #Integration-Server-and-ESB
    #webMethods


  • 5.  RE: How to convert timezone in ESB service

    Posted Tue March 12, 2019 09:20 AM

    Hi Gerardo

    I tried to run the pub.date:formatDate.
    I have given input in date field as : 03/01/2019 09:05:03
    pattern as : MM/dd/yyyy HH:mm:ss
    timezone : IST

    But it is giving an error :
    java.lang.ClassCastException: java.lang.String cannot be cast to java.util.Date

    Thanks
    Sushant


    #Integration-Server-and-ESB
    #webMethods


  • 6.  RE: How to convert timezone in ESB service

    Posted Tue March 12, 2019 08:49 PM

    The input date passed to service “pub.date:formatDate” should be java.util.Date

    Try the below code for your testing:

    pub.date:getCurrentDate
    pub.date:formatDate

    Refer 10-3_Integration_Server_Built_In_Services_Reference.pdf for more details.


    #webMethods
    #Integration-Server-and-ESB