‎2009 Apr 07 1:44 PM
Hi,
I have to dates e.g 20090510 and 20090407. when I subtract them together I wanna know how many days are they apart by. in this example they are 33 days apart.
Can you please assist me.
Regards,
B
‎2009 Apr 07 1:46 PM
u should supstract variables that are type DATS.
for example:
days = date1 - date2.days can be string type variable.
‎2009 Apr 07 1:46 PM
u should supstract variables that are type DATS.
for example:
days = date1 - date2.days can be string type variable.
‎2009 Apr 07 1:46 PM
Hi
use FM DAYS_BETWEEN_TWO_DATES
thses will aso help you
LEAP_DAYS_BETWEEN_TWO_DATES
MONTHS_BETWEEN_TWO_DATES
RELATION_BETWEEN_TWO_DATES
Thanks
Edited by: jeevitha krishnaraj on Apr 7, 2009 2:49 PM
‎2009 Apr 07 1:47 PM
HI,
Check for this Fm HR_99S_INTERVAL_BETWEEN_DATES
or
data l_date1 type sy-datum value '20090510'.
data l_date2 type sy-datum value '20090407'.
data l_date3 type i.
l_date3 = l_date1 - l_date2.
write: l_date3.
‎2009 Apr 07 1:48 PM
All you have to do is declare two variables of type D and pass on these values to them. Declare another variable of type I and pass the subtracted value into it.
DATA:
w_highdate type D,
w_lowdate type D,
w_difference type I.
w_highdate = '20090510'.
w_lowdate = '20090407'.
w_difference = w_highdate - w_lowdate.
‎2009 Apr 07 1:51 PM
try with the FM given below:
SD_DATETIME_DIFFERENCE
Give the difference in Days and Time for 2 dates
With luck,
Pritam.
‎2009 Apr 07 1:53 PM
Hi, Beatrice.
Please Search Before Posting Basic Queries
Best Regards,
Faisal
‎2009 Apr 07 1:57 PM
Hi,
Please check on this code... this works for sure
parameters :
p_date1 type sy-datum,
p_date2 type sy-datum.
data : w_diff type i.
start-of-selection.
if p_date2 > p_date1.
w_diff = p_date2 - p_date1.
else.
w_diff = p_date1 - p_date2.
endif.
end-of-selection.
write w_diff.Regards,
Siddarth