cancel
Showing results for 
Search instead for 
Did you mean: 

SAP PI - Convert Date between Time Zone

tharaka_fernando
Contributor
0 Kudos

Dear All,

In my PI development, I am getting a Date value (as a string) ; "2015-07-31T12:00:00.000-07:00" which is UTC time format. I need to convert this to Pacific time Zone (which is 07 hours back)

I understand that I need to write a UDF for this ,

simply can you please tell me how to subtract 07 hours from my input in a UDF ..

thank you all in advance.....

Accepted Solutions (0)

Answers (3)

Answers (3)

ekp_shendi
Discoverer
0 Kudos

Good Morning Gurus,


I have implemented the UDF on SAP PO. It works fine, for example for Europe/Berlin to Etc/UTC but it does not work the other way around (so: Etc/UTC -> Europe/Berlin).

Any ideay why this could not work? Parameters are:

- format: yyyyMMddHHmmss

- from time zone: Etc/UTC

- to time zone: Europe/Berlin

Any idea is highly appreciated.

Best Regards

Acram

Former Member
0 Kudos

Hi Fernando,

You need to consider the Date Format Pattern as well.

By looking your Date Format it is in yyyy-MM-dd'T'hh:mm:ss.SSS XXX format.

The XXX format pattern is only available from Java 7,if you have Java 6 then it will not recognize this pattern . If your date format is in yyyy-MM-dd'T'hh:mm:ss.SSS Z format then it will work with Java 6.


Check Java API for SimpleDateFormat patterns.

Best Regards

Amith Bhumu

engswee
Active Contributor
0 Kudos

Fernando

Check out my blog below for how you can implement time zone conversion in a UDF.

Rgds

Eng Swee

tharaka_fernando
Contributor
0 Kudos

Hi Eng,

Thank you for the reply...

I will follow the option 2 according to your blog..One thing that I don't understand is how to "Import JAR file into an Imported Archive object". (according to prerequisite in your blog- option 2 )

Thanks

engswee
Active Contributor
0 Kudos

Fernando

You can always find details like this if you use SCN Search. There are a lot of info that can be found through searching before you ask/post further.

Below is an example blog that turns up in a search showing how to add a JAR into an imported archive

Rgds

Eng Swee

tharaka_fernando
Contributor
0 Kudos

Hi Eng,

Thank you for your reply..But does this include Daylight saving time ?

If we need to calculate Daylight saving ...how to do that in PI ?

former_member184720
Active Contributor
0 Kudos

If you are using JODA's library, DST should be automatically considered.

Instead of giving the "EST", "PST", we should supply "America/New_York", "America/Los_Angeles" etc