Application Development 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: 

How to get date of previous months

Former Member
0 Kudos

Hi,

I want to know if I'm having todays date, how get I get a date just knowing the difference on month.

For Exmp.

Let diff is of 12 months.

i.e. if 29/02/2004 should give 28/02/2003

and 28/02/2003 should return 28/02/2002

and 01/03/2005 return 01/03/2004

1 ACCEPTED SOLUTION

anversha_s
Active Contributor
0 Kudos

hi,

chk this.

data : wa_date type sy-datum.
 
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 0 --------------------> "give ur required days
months = 12 --------------------> "give ur required month
years = 0
signum = '-'
importing
calc_date = wa_date.
 
write 😕 wa_date. -> new minised date

Note
."signum = '+' " 
."signum = '-' "

rgds

Anver

1 REPLY 1

anversha_s
Active Contributor
0 Kudos

hi,

chk this.

data : wa_date type sy-datum.
 
call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = sy-datum
days = 0 --------------------> "give ur required days
months = 12 --------------------> "give ur required month
years = 0
signum = '-'
importing
calc_date = wa_date.
 
write 😕 wa_date. -> new minised date

Note
."signum = '+' " 
."signum = '-' "

rgds

Anver