10-07-2009 5:53 PM
I have 4 fields: starte date, start time, end date and end time.
Is there a standard function or how do I write a function to calulate the time? Input field should be starte date, start time, end date and end time. Ouput should be time difference in hours.
Thanks for your help in advance.
10-07-2009 5:59 PM
10-07-2009 5:59 PM
10-07-2009 6:05 PM
It's actually not that basic to calculate time differences across different dates.
Rob
10-07-2009 6:08 PM
Hi Rob ,
actually it should be Frequently asked Question
Hi Amy,
use this
PARAMETERS:p_stime TYPE sy-uzeit,
p_etime TYPE sy-uzeit,
p_sdate TYPE sy-datum,
p_edate TYPE sy-datum.
DATA: v_hours TYPE p DECIMALS 2.
v_hours = ( ( p_edate - p_sdate ) * 24
+ ( p_etime - p_stime ) / 3600 ).
or use
SD_CALC_DURATION_FROM_DATETIME
Edited by: Keshu Thekkillam on Oct 7, 2009 10:41 PM
Edited by: Keshu Thekkillam on Oct 7, 2009 10:47 PM
10-07-2009 6:40 PM
>
> actually it should be Frequently asked Question
Guess you're right. I don't normally look too closely at time questions.
Should I unassign the points?
Rob
Edited by: Rob Burbank on Oct 7, 2009 1:40 PM
10-07-2009 7:18 PM
10-07-2009 7:35 PM
Thank you all for your help. I've given points to the helpful answers.
10-07-2009 7:52 PM
Thanks amy, but next time remember that just about every question possible has been asked and answered before. If you search before posting, you are very likely to find an answer.
Rob
10-07-2009 6:08 PM
Amy,
You can use FM CCU_TIMESTAMP_DIFFERENCE. It takes Timestamp1 and Timestamp2 as parameters and returns time difference in seconds.
Gajendra