cancel
Showing results for 
Search instead for 
Did you mean: 

Syntax for date a week back

Former Member

Hi ,

Please give me the syntax to find the date exactly 1 week back and 2 weeks back.

Another question is ....how do I change date formats , please give me syntax.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

Hi,

To get before week day date just subtract 7 days form the field of type D. like this for two week also we can do.

to write date in desired formate just write the formate option beside the date field. like

write: sy-date, mm/dd/yyyy.

for more details write edit at any place of program and press F1 to get system help where we can choose own date format.

Regards,

Aswini.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Ramana,

date exactly 1 week back:

w_date = sy-datum - 7.

date exactly 2 weeks back:

w_date = sy-datum - 14.

Check out this link for date format changes:

http://www.sap-basis-abap.com/sd/date-format-changes.htm

Regards,

Chandra Sekhar

Former Member
0 Kudos

hi,

result_date = sy-datum - 7.

result_date = sy-datum - 14.

These two statements will give you the date of exactly one week ago and two weeks ago respectively...

set the date format in user profile

regards

padma

Former Member
0 Kudos

Hi,

data:w_date type sy-datum.

w_date = sy-datum - 7. " For 1 week back from current date.

w_date = sy-datum - 14. " For 2 week from current date.

Regards,

sujit