Skip to Content

I have seen in many Blogs  where people asking about several converting time format  from 24 hours to 12hours and in most of the cases people have suggested to go for UDF to get the desired  TIME format. I hope this blog will be very useful for beginners. Here in this blog i am explaining how to convert time format in different approaches with out udf  .

Let’s say we have incoming dates as  05/04/20112 23:57:47 & 06/04/2012 00:01:15 and  we want to get the desired output as 05/04/20112 11:57:47 PM and 06/04/2012 00:01:15 AM

To get the above result we don’t need to write any UDF, it is simply possible by using standard  functions.

Input: we have to provide CurrentDate function or input parameter.

Approach 1: by using some standard functions for practice

Example 1 : with currentDate

Open the “currentDate” function of the Date Function Group and double click  and then selected format (mm/dd/yyyy hh:mm:ss )  and  “Target Format” as shown in below picture.


Step2: Mapping logic as converted from input  like “mm/dd/yyyy HH:mm:ss” to  “mm/dd/yyyy hh:mm:ss AM/PM”


finally the result is :


example2: Repeat the above logic with  “Input parameter” and here we have taken “SYSTEM”  as Input parameter.


result is:



Approach 2: By using Standard Function “dateTrans”:

we have to select dateTrans Function of the Date Function Group then double click  and select input parameter and out parameters based on requirement.

for ex:


note : if we need hours is 12 hours format then we have to change maually hours HH to  hh and add a letter end of the parameter as like showing in picture .

output is :



To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Former Member

    Hi Solasu.

    Why don’t you just use the DateTrans function to do the conversion for you?

    There’s no need to create a field-mapping of 13 functions, when it can be done using only DateTrans. According to SAP documentation the functions under Date-category adheres to java.util.SimpleDateFormat, which allows you to specify exactly the date format you might need.

    Best regards,


    1. Former Member Post author

      i agree that is possiable in some cases and this is converting 24 h to 12 h format .

      if u use dateTrans function , 03/03/2011 22:11:11 it’s input converting to

      03/03/2011 22/11/11 PM

      but my logic is converted to

      03/03/2011 10/11/11 PM
      1. Former Member

        Hi Bhavani,

        You should keep in mind that HH is Hour in day (0-23) and hh is Hour in am/pm (1-12). It seems like the output date format you used in DateTrans included HH instead of hh.

        Best regards,



Leave a Reply