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

Change the date format

Former Member
0 Likes
869

Hi all,

In my internal table I have a date field which is in dd/mm/yyy format.But I have to display it in screen as d-mm-yyyy format.

Can anyone guide me how to do that.

Thanks,

Uga.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
841

If u have declared the date field of the type date, then u can use the concatenate command to serve your purpose:

Just declare a variable

d_date1 TYPE begda, "Temp Var To Store Start Date

CONCATENATE wa_final_temp-budat+0(4)

wa_final_temp-budat+4(2)

wa_final_temp-budat+6(2) INTO d_date1.

The type begda...i have just taken for reference u can take any other type which supports the date format

If u have declared the date field of the type date, then u can use the concatenate command to serve your purpose:

Just declare a variable

d_date1 TYPE begda, "Temp Var To Store Start Date

CONCATENATE wa_final_temp-budat+0(4)

wa_final_temp-budat+4(2)

wa_final_temp-budat+6(2) INTO d_date1.

The type begda...i have just taken for reference u can take any other type which supports the date format

5 REPLIES 5
Read only

Former Member
0 Likes
841

Hi!

If you date is stored in character field, you can use the

REPLACE ALL OCCURRENCES OF '/' IN lv_field WITH '-'.

With date type field, you can change your user profile to modify the date format: choose menu System - User profile - Own data, then set your time format here.

Regards

Tamá

Read only

Former Member
0 Likes
841

Hi

define variables for month, date and year and split that system date to them and concatenate them to a date field required by you and use it on screen.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
841

Hi,

You can do this way ...not exactly but .. try this method out..will work in the way you want the date.,...

DATA: V_INPUT(8) VALUE '20112006'.

DATA: V_CHAR(25).

data: date type sydatum.

DATA: MONTH_NAMES LIKE T247.

SELECT SINGLE * FROM T247

INTO MONTH_NAMES

WHERE SPRAS = SY-LANGU

AND MNR = V_INPUT+2(2).

CONCATENATE MONTH_NAMES-KTX V_INPUT(2) V_INPUT+4(4)

INTO V_CHAR SEPARATED BY SPACE.

write: / V_CHAR.

Regards,

Jayant

Read only

Former Member
0 Likes
842

If u have declared the date field of the type date, then u can use the concatenate command to serve your purpose:

Just declare a variable

d_date1 TYPE begda, "Temp Var To Store Start Date

CONCATENATE wa_final_temp-budat+0(4)

wa_final_temp-budat+4(2)

wa_final_temp-budat+6(2) INTO d_date1.

The type begda...i have just taken for reference u can take any other type which supports the date format

Read only

Former Member
0 Likes
841

Hi Uga,

Refer this code :

data : v_date(10) type char.

concatenate itab-date0(2) '-' itab-date3(2) '-' itab-date+6(4) into v_date.

Reward points if helpful.

Regards,

Hemant