Application Development and Automation 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: 
Read only

calculate difference between two dates/times

Former Member
0 Likes
3,930

Hi all,

Is there any function module to calculate difference between two dates/times which are in TIMESTAMPL format.

I need to know how many millisconde(second,minutes, hours... )there is between these two times.

Please, It is urgent

Thank you all.

Karim

7 REPLIES 7
Read only

Former Member
0 Likes
1,096

Try this FM

SD_DATETIME_DIFFERENCE

or

SD_CALC_DURATION_FROM_DATETIME

Regards,

Ram

reward points if helpful

Message was edited by:

Ram Mohan Naidu Thammineni

Message was edited by:

Ram Mohan Naidu Thammineni

Read only

Former Member
0 Likes
1,096

hi,

To find differance between two dates....

use FM...

<b>HR_HK_DIFF_BT_2_DATES</b>

this will give you differance between times in any format means...days, days and months, days months years, only years, only months etc.. based on ouput paramter u pas sto this FM.

and make sure that the dates that you pass DATE1 should b greater than DATE2 otherwise it will give an error dump.

other than this you can use FM...

<b>SD_DATETIME_DIFFERENCE</b> also...whish will give you the differance between date and time too.

<b>Reward points for helpful answers,</b>

Regards,

Tejas

Read only

Former Member
0 Likes
1,096

hi,

try n use:

SD_CALC_DURATION_FROM_DATETIME : Find the difference between two date/time and report the difference in hours

all the best!!

Regards,

Aparna

Read only

Former Member
0 Likes
1,096

Thank you guys.

But I need a FM module wich take 2 parameters (TIMESTAMPL with milliseconde) and return the differences.

example : timestampl1 = 20070328120950,123

timestampl2 = 20070328131051,124

result = 01:01:1,001

Could anyone help me?

regards

Karim

Read only

0 Likes
1,096

hi,

try the following function

CALL FUNCTION 'CCU_TIMESTAMP_DIFFERENCE'

EXPORTING

timestamp1 = timestamp1

timestamp2 = timestamp2

IMPORTING

difference = diff

EXCEPTIONS

OTHERS = 1.

the above function gives the difference in seconds...

try the following code to set the resolution to milliseconds..

SET RUN TIME CLOCK RESOLUTION LOW

check the thread for details:

all the best!!!

Regards,

Aparna

Read only

Former Member
0 Likes
1,096

Hi Karim,

You can use this function module:

CCU_TIMESTAMP_DIFFERENCE

this takes 2 time stamp as input and returns the difference.....

Thanks and Regards,

Kunjal Patel

Read only

Former Member
0 Likes
1,096

hi,

the following fm may also help..

TIMECALC_DIFF

SCSM_TIME_DIFF_GET

SCOV_TIME_DIFF

SRET_TIME_DIFF_GET

all the best!!

Aparna