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

Time difference calcualtion

Former Member
0 Likes
533

Hi All,

I want to calcualte the difference of two times provided

for eg : 09:46:00 PM - 09:45:00 am = 12 hrs 01 mins 00 seconds.

I have tried with a couple of standard Fms but couldn't find an appropriate one that gives me the difference in the format HH:MM:SS.

Is there any soln for this ?

Regards,

Beena

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
517

Hi Beena

If your problem is solved and there is no need of further inputs on this, please close the thread.

Regards

Ashish Jain

4 REPLIES 4
Read only

Former Member
0 Likes
517

Hi Beena

I tried a piece of code, it works for me:

REPORT ZTEST_ASH.

data: time1 like sy-uzeit.

data: time2 like sy-uzeit.

data: time like sy-uzeit.

time1 = sy-uzeit.

time2 = '120101'.

time = time1 - time2.

write: time.

It gives me output in the format- HH:MM:SS

Here, you need to enter time1 and time 2 as: 'HHMMSS'

Regards

Ashish

Read only

Former Member
0 Likes
517

Hi Beena

I found something else for you

If you are using your time variables of type 'T', then my previous piece of code doesn't work as you desire (it was working fine for ... like sy-uzeit), so look at the new one:

REPORT ZTEST_ASH.

data: time1 type t.

data: time2 type t.

data: time type t.

time1 = sy-uzeit. " or you can give any time

time2 = '120101'.

time = time1 - time2.

WRITE (8) TIME USING EDIT MASK '__:__:__'.

WRITE (20) TIME USING EDIT MASK '__ hrs __ min __ sec'.

I hope it will close the issue

Cheers

Ashish

Read only

0 Likes
517

Hi Ashish ,

Thank u very much ..it solved my problem

rgds

beena

Read only

Former Member
0 Likes
518

Hi Beena

If your problem is solved and there is no need of further inputs on this, please close the thread.

Regards

Ashish Jain