on 06-23-2016 7:20 PM
Hi All,
Can you please let me know if we can achieve the below date transformation in graphical mapping or we have to go with UDF - in which case - I might need help on the UDF.
Input Date: 2016-05-11T16:21:12.000-04:00
Output Date: 05/11/2016 16:09:08 MDT
I hoping we can acheive through regular date transformation - however, it failed to recognize - yyyy-MM-dd'T'HH:mm:ss.SSSZ - so I wasnt sure if this is the correct representation of 2016-05-11T16:21:12.000-04:00 ?!
Thank you so much for your timely help in advance!!
Thank you,
Rithvik
Hi Rithvik
I'm guessing your PI system is not on 7.5 yet, so it is running on Java 6 (if on 7.31 or 7.4) or below.
Java 6 or below does not support the ISO 8601 time zone format in it's SimpleDateFormat class. Refer the following discussion - Converting ISO 8601-compliant String to java.util.Date - Stack Overflow
Your input is in ISO 8601 format (time zone with a colon : character). As such, it is unable to parse it correctly, and it has nothing to do with the T character.
That explains your problem.
However, it is unclear what is your requirement. From your input/output examples: MDT (Mountain Daylight Time) is -06:00 and does not correspond to -04:00.
Do you want to just change the date format and retain the it in the same time zone. Or do you want to change time zones as well?
Either way, I'd suggest you go for Joda Time libraries to assist you in handling the conversion. It will be able to parse ISO 8601 format properly, and change time zones if necessary. You can check out my blog below:-
Regards
Eng Swee
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.