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

Date Format

naveen_inuganti2
Active Contributor
0 Likes
807

hi...

write:/ sy-datum

(which gives today's date as 15/04/2008)

I want output as 04/2008 (month and year only)

how?

thank you,

Naveen

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
746

HI,

You get the date as 15/04/2008

date: gv_month(2),

gv_year(4),

gv_date(7).

gv_month = sy-datum+3(2).

gv_year = sy-datum+6(4).

concatenate gv_month gv_year into gv_date separated by '/'.

6 REPLIES 6
Read only

Former Member
0 Likes
747

HI,

You get the date as 15/04/2008

date: gv_month(2),

gv_year(4),

gv_date(7).

gv_month = sy-datum+3(2).

gv_year = sy-datum+6(4).

concatenate gv_month gv_year into gv_date separated by '/'.

Read only

Former Member
0 Likes
746

hi,

do this way ...


data : v_date(10).

concatenate sy-datum+4(2) '/' sy-datum+0(4) into v_date.

write : v_date. 

Read only

former_member609120
Contributor
0 Likes
746

You get the date as 15/04/2008

date: gv_month(2),

gv_year(4),

gv_date(7).

gv_month = sy-datum+3(2).

gv_year = sy-datum+6(4).

concatenate gv_month gv_year into gv_date separated by '/'.

Read only

Former Member
0 Likes
746

Hi,

Do like this

Once you get the value 15/04/2008 into a variable for ex: v_date is 15/04/2008

v_date2 = v_date+2(8).

Here v_date2 will have the value 04/2008.

Regards,

Satish

Read only

Former Member
0 Likes
746

Hi Naveen Inuganti,

Try out this way...


DATA : DATE1 TYPE SY-DATUM,
DD(2) TYPE C,
MM(2) TYPE C,
YY(4) TYPE C,
NEW_DATE(7) TYPE C.

DATE1 = SY-DATUM.

DD = DATE1+0(2).
MM = DATE1+2(2).
YY = DATE1+4(4).

CONCATENATE MM '/' YY INTO NEW_DATE.

Again it depends on the user settings ...

so.. Better use offset and get the individual DD MM and YYYY using offset...

and then use concatenate to get ur desired value...

Set user date setting from SU01...

Hope it will solve your problem...

Reward points if useful...

Thanks & Regards

ilesh 24x7

Read only

Former Member
0 Likes
746

Hi Naveen,

Use any of the below formats.

write:/ sy-datum(6).

OR

write:/ sy-datum4(2),'/',sy-datum0(4).