cancel
Showing results for 
Search instead for 
Did you mean: 

Help with DateTrans function YYYY-MM-DDTHH:MM:SS

0 Kudos

Hi Folks,

I have a req where the input date format yyyy-dd-MMTHH:mm:ss should be to convert MM/dd/yyyy.

I am using the datetrans function to achieve this..but its failing in pi

ex:<mo:EventTimeStamp>2014-12-03T14:16:20</mo:EventTimeStamp>

but it fails with runtime error Illegal pattern character 'T'

Can anyone help me how to achieve this ?if there is any udf ,please post me here

Regards,

Kalyan

Accepted Solutions (1)

Accepted Solutions (1)

giridhar_vegi
Participant
0 Kudos

Hi kalyan,

               Do the mapping as specified below.

Thanks

Giridhar

engswee
Active Contributor
0 Kudos

This solution by Giridhar is a possible solution too.

But you might want to learn why your earlier config was not working, when it is really possible for it to work. It might come in handy in the future when you have a similar input but your output requires the HHmmss part as well.

You know what they say about giving someone a fish and teaching him/her how to fish.

0 Kudos

Hi Giridhar,

Your solution worked in my mapping..Thanks for your help..

Regards,

Kalyan

Answers (2)

Answers (2)

former_member187587
Contributor
0 Kudos

Which java version you have installed on PI host?

different java versions has diffrent handling for timezones.


engswee
Active Contributor
0 Kudos

There is no timezone in the input pattern.

former_member187587
Contributor
0 Kudos

Use the standard DateTrans method.

your input format should be :    yyyy-dd-MM'T'HH:mm:ss

your output format should be :  MM/dd/yyyy

works for me (PO 7.4)

RaghuVamseedhar
Active Contributor
0 Kudos

Kalyan,

Please check Eng response "T is not one of the allowed characters to need to be encapsulated in single quote 'T'  "

0 Kudos

Tried above approach..but its failing...

iaki_vila
Active Contributor
0 Kudos

Hi Kalyan,

Why don't skip with a substring function for example the T character previous the datetransfunction?

You can try with these suggestions as well java - How can I convert a timestamp from yyyy-MM-ddThh:mm:ss:SSSZ format to MM/dd/yyyy hh:mm:ss.SSS..., but i think to ommit the T or Raghu suggestion should be enough.

Regards.

engswee
Active Contributor
0 Kudos

You really don't need a UDF for this. The input/output format for your DateTrans function might incorrectly configured to match your actual input values.

Please provide following screenshots:

- your configuration for DateTrans

- the Display Queue value of the input before DateTrans

- the error message you are getting


former_member182412
Active Contributor

Hi Kalyan,

Use below formats in DateTrans function, i used the same in all of my mappings and they are working fine.

Regards,

Praveen.