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

difference in date / Urgent

Former Member
0 Likes
754

hi all ,

can anybody tell me how can we calculate the difference between dates like in (01.03.2008 - 02.11.2001) or in (22.01.2007 - 03.11.1984) or in ..............

its urgent .

regards saurabh .

hi all ,

can anybody tell me how can we calculate the difference between dates like in (01.03.2008 - 02.11.2001) or in (22.01.2007 - 03.11.1984) or in ..............

its urgent .

regards saurabh .

4 REPLIES 4
Read only

former_member188829
Active Contributor
0 Likes
736

Hi,

check this program..

data:date1 type d value '20080204'.

data:date2 type d value '20080208'.

data:days type i.

days = date2 - date1.

write:days.

Read only

Former Member
0 Likes
736

Hi,

You can use below FMs to calculate and days and months for given two days.

DAYS_BETWEEN_TWO_DATES "For Days

MONTHS_BETWEEN_TWO_DATES "For months.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
736

hi,

use function module 'DAYS_BETWEEN_TWO_DATES'

regards,

Sowmya.

Read only

Former Member
0 Likes
736

Hi,,

Saurabh..

here no need of any function modules as sap provides a great ease for programers unlike in other languages no need to calculate no of days etc etc

all this will be taken care by the data type conversion

if u assign data type d to type i then the variable with the type i holds no of days in it

so u can do directly like this

data:

d1 type d value '20080120',

d2 type d value '20080115',

days type i.

days = d1 - d2.

write days.

o/p will be 5.

as the difference days is 5.

plzz reward if it is usefull...

plzz dont forget to rerward........