Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to calculate duration between 2 timestamps?

Former Member
0 Kudos

Hi,

I am using this FM CRM_ORDER_READ_OW in CRM to get the start and end time of a request.

Format - DD.MM.YY HH.MM.SS

Start time = 19.11.2012 18:09:33 CET

End time = 26.11.2012 18:09:33

Can you please guide on how can I calculate the duration in HOURS between these 2 timestamps?

Thank you very much!

Kind regards,

Rebekah

1 ACCEPTED SOLUTION

satyabrata_sahoo3
Contributor
0 Kudos
14 REPLIES 14

0 Kudos

Hi Rabekah,

Use below FM

CCU_TIMESTAMP_DIFFERENCE

Regards

Sarvesh

satyabrata_sahoo3
Contributor
0 Kudos

karun_prabhu
Active Contributor
0 Kudos

Hi Sunil,

     Make use of the function L_TO_TIME_DIFF.

Regards.

0 Kudos

Hi Arun,

Is this FM in CRM? I cant seem to find it.

0 Kudos

Sunil,

     I am not sure about that.

     If it is not there, refer the link mentioned by Satyabrata Sahoo.

Regards.

0 Kudos

I'm afraid the FMs given in that link also does not exist there

0 Kudos

Hi,

Use this FM CCU_TIMESTAMP_DIFFERENCE   or   OII_CALC_DIFF_BT_TIMESTAMPS

or try like this way to find FM in se37

Former Member
0 Kudos

Hi,

Check FM 'CCU_TIMESTAMP_DIFFERENCE' You will get the result in sec, divided by 3600 you will get the result in hours, pass the input values as YYYYMMDDHHMMSS.

Thanks

Ravi

venkateswaran_k
Active Contributor
0 Kudos

Hi

Use the following FM:  CCU_TIMESTAMP_DIFFERENCE

Provide inputs as  DDMMYYYYHHMMSS format

The output would be in Seconds.

Divide by 60 to get in minutes

In the above, I give example as  today  09 am to 11:00 am

It gives 7200 seconds, that is 120 minutes that is 2 hours

Regards

Venkat

0 Kudos

Hi Rabekah,

Use below FM

CCU_TIMESTAMP_DIFFERENCE

Regards

Sarvesh

VijayaKrishnaG
Active Contributor
0 Kudos

Hi Rebekah,

Try this function module /SDF/CMO_DATETIME_DIFFERENCE

Thanks & Regards,

-VIJAY

Former Member
0 Kudos

Hi,

Use the FM 'DELTA_TIME_DAY_HOUR' which will give you the diffence in minutes

divide the minutes by 60 to get the answer in hours.

10080/60 = 168 hours

Regards,

Jayashree

former_member195402
Active Contributor
0 Kudos

Hi Rebekah,

FM IGN_TIMESTAMP_DIFFERENCE will give you the result rounded in hours, when import parameter I_UNIT is set to 'H'.

Regards,

Klaus

Former Member
0 Kudos

Hi Rekebeh,

U can use this FM.

CALL FUNCTION 'LTRM_TIME_GAP_CALC' "Calculate time difference between two time stamps

  EXPORTING

    i_locat =                   " lloct-locat   Site

    timestamp1 =                " ccupeaka-timestamp  Timestamp im Format "JJJJMMTTHHMMSS"

  IMPORTING

    difference =                " i             Difference TimeS1 - TimeS2

    .  "  LTRM_TIME_GAP_CALC.