How to convert timezone in ESB service

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

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

Hi ,

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

Thanks
Sushant

Hi,

pub.date:formatDate might be useful here.

Best regards,

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

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.