‎2006 Mar 13 12:55 PM
Hi All ,
i have a requirement to calculate the difference between two corresponding date & time.
for eg: ( date2 & time2 ) - ( date1 & time1 )
the resultant field should give me time either in hrs or minutes.
i have used "SD_DATETIME_DIFFERENCE" it is working but it is giving the value as 0. if the time difference is less than 1 hr. but the requirement is to get the minutes also .
Thanks in Advance
Kishore Kumar Yerra.
‎2006 Mar 13 12:58 PM
Hi,
try FM
DAYS_BETWEEN_TWO_DATES
FIMA_DAYS_BETWEEN_TWO_DATES
FIMA_DAYS_BETWEEN_TWO_DATES_2
and for time
HRVE_GET_TIME_BETWEEN_DATES
hope it helps..
Lokesh
‎2006 Mar 13 1:00 PM
Hi Kishore,
YOu can directly use a int variable to hold the difference.
data: v_date_diff type i,
v_time_diff type i.
v_date_diff = date2 - date1.
v_time_diff = time2 - time1. " Gives difference in seconds
v_time_diff = v_time_diff / 60. " Gives difference in Minutes
‎2006 Mar 13 1:01 PM
‎2006 Mar 13 1:01 PM
Hi,
you don't need any function to do that .
data : w_date type sy-datum value '20060101' ,
w_hour type sy-uzeit value '080134' ,
w_dat2 type sy-datum value '20060201' ,
w_hou2 type sy-uzeit value '070554' .
w_date = w_dat2 - w_date.
if w_hour lt w_hou2.
w_date = w_date - 1.
endif.
w_hour = w_hou2 - w_hour.
write : /1 w_date ,
w_hour.Rgd
Frédéric
‎2006 Mar 13 1:05 PM
hi kishore ,
use this fm .
L_TO_TIME_DIFF.
I_START_DATE --start date
I_START_TIME 00:00:00
I_END_DATE ---enddate
I_END_TIME 00:00:00
I_TIME_UOM -
hrs/min/sec
pass the following parametes and get the difference in hrs or min or sec ,.
hope this helps u out .
regards,
vijay.
I_START_DATE 03/12/2006
I_START_TIME 18:00:00
I_END_DATE 03/12/2006
I_END_TIME 24:00:00
I_TIME_UOM MIN
Export parameters Value
E_TIME_DIFF 360.000
Message was edited by: Kan Vijay
‎2006 Mar 13 1:08 PM
u can use:
data : time type sy-uzeit.
if time difference lt 1.
time = time1 - time2.
min = time+2(2).
Regards,
Bikash