cancel
Showing results for 
Search instead for 
Did you mean: 

Converting date using PI mapping function

Former Member
0 Kudos

Hi,

In need to convert following date '20130708' (YYYYMMDD) into '2013-07-08T00:00:00+05:30' format in PI mapping.

Is it possible to convert using PI mapping functions.

If Yes then how?

If No then is there any other method by which conversion can be done?

Thanks & Regards,

Vinit.

Accepted Solutions (0)

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Vinit,

You can use this mapping.Here,I am assuming 08T00:00:00+05:30' this as fixed value since you have not mentioned anythings.

Output:-

Please let me know if you this ok with you.

Regards,

Abhi


Former Member
0 Kudos

Hello Abhinav/Hanee,

I am just trying to understand apart from posting screenshot what extra information is there in ur reply becoz whatever u have posted has already been shared above?

IMO it's against SCN Rules of Engagement. So please don't take it otherwise and try to avoid posting reply which has already been shared in the same thread.

Thanks

Amit Srivastava

iaki_vila
Active Contributor
0 Kudos

Hi Amit,

Hehe sometimes a screenshoot is helpful and Abhinav uses a constant, this is not at elegant way but finally Vinit will be who takes the option that he considers better. However, i understand that the answers are very similar.

Regards.

Former Member
0 Kudos

Hi Amit,

When I was posting my solution,I saw only Question posted so I open the thead and posted my solution.Might be someone else was also posting the solution in the meantime.

But I understand,solutions are very simmillar.So,I will try to keep this in mind in future.

Regards,

Abhi

Former Member
0 Kudos

Hi Vinit,

By simply using the DateTrans function, you can do your reuqired date transformation in PI graphical mapping itself. Please refer the below screenshot.

Hope It will help you.

Former Member
0 Kudos

Hello,

U want to convert date into some specific timezone format? If yes then u need a java code, otherwise u can just use date transformation function.

In Date function:

Input will be: yyyyMMdd

Output will be: yyyy-MM-dd'T'00:00:00+5:30

Thanks

Amit Srivastava

praveen_sutra
Active Contributor
0 Kudos

hi Vinit,

you can use below code in the UDF after modifying it.

{

Date dNow = new Date();

SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ");

System.out.println("Current Date: " + ft.format(dNow));

}

thanks and regards,

Praveen T

former_member184720
Active Contributor
0 Kudos

Hi Vinit - Why don't you use concat function. I believe the later part is fixed value as you don't have timestamp information from the sender.

Ofcourse to convert the date part you can use standard function with input  yyyyMMdd and output yyyy-MM-DD then use concat..