10-11-2008 8:33 AM
Dear all,
i have a date like 01.10.2008 & 31.10.2008.
now i want to count the number of sundays arrived in between this month.
Have any function???????????
plz help me.
Anshuman
10-11-2008 8:40 AM
try using this code
data: begdat type sydatum,
enddat type sydatum,
day type p,
counter type i.
begdat = '20081001'.
enddat = '20081031'.
do.
day = begdat mod 7.
if day > 1.
day = day - 1.
else.
day = day + 6.
endif.
if day = '6'.
counter = counter + 1.
endif.
if begdat < enddat.
begdat = begdat + 1.
else.
exit.
endif.
enddo.
write: counter,'SUNDAYS'.
10-11-2008 8:40 AM
try using this code
data: begdat type sydatum,
enddat type sydatum,
day type p,
counter type i.
begdat = '20081001'.
enddat = '20081031'.
do.
day = begdat mod 7.
if day > 1.
day = day - 1.
else.
day = day + 6.
endif.
if day = '6'.
counter = counter + 1.
endif.
if begdat < enddat.
begdat = begdat + 1.
else.
exit.
endif.
enddo.
write: counter,'SUNDAYS'.
10-11-2008 9:15 AM
10-11-2008 9:40 AM
Hi,
Plz. check ur code with 01/03/2007 and 31/03/2007
result comming incorrect
10-11-2008 8:48 AM
use this
HR_IE_NUM_PRSI_WEEKS to get the number of weeks between two given dates.
from this output derive the sunday.
If we have 2 weeks there will be 2 sundays right.
Try this..................
Regards,
Midhun Abraham
Edited by: Midhun Abraham on Oct 11, 2008 10:48 AM
10-11-2008 9:40 AM