cancel
Showing results for 
Search instead for 
Did you mean: 

Date time format help

Former Member
0 Kudos

Hi Experts,

I am getting date-time in 2009-09-17 13:05:16 format. But I need to send it to database as 2009/9/17 1:05:16 PM format.

When date is 08 only 8 needs to be present. And time should be in AM/PM format. Please suggest..

Thanks,

Vishal

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Vishal,

source field --> datetrans function --> target.

Double click on datetrans fucntion and on source format put yyyy-MM-dd HH:mm:ss and in target format put yyyy/MM/dd K:mm:ss a

Copy and paste directly from here. If you write you may miss something. Then your output should be as expected.

Regards,

---Satish

Former Member
0 Kudos

Thanks Satish.. It works..

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Vishal,

There is no standard functionlity for this. you have to write the UDF for converting the 24-hour time format to 12-hour time format. check the below link for the UDF code

http://codingforums.com/showthread.php?t=156800

Regards

Ramesh

Former Member
0 Kudos

Hi Vishal,

Use the DateTrans function and provide the OutPut date format as : yyyy/M/dd HH:mm:ss

this will convert the 08 month to 8

Former Member
0 Kudos

Hi Vishal,

You can make use of the Date Transformation function available in the stabdard functions if the SAP PI mapping editor. If some specific requiremenbt of handling time zone, then you need to write UDF.

Thanks

Ajay

Former Member
0 Kudos

Yes.. but how to convert 13:05:45 to 1:05:45 PM.. And if day is 08 it should be sent as just 8.. It's not possible to handle in date transformation function..

Former Member
0 Kudos

I dont see any option to convert the 24 hr time system to 12 hr system. You may have to write an UDF for time conversion.

Thanks

Pooja