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

Changing the date Format

shilpik20
Explorer
0 Likes
545

I have managed to copy the system date to a field using the sy-datlo. Now i want to change the date format to 'MM/DD/YYYY'. Please Help.

1 ACCEPTED SOLUTION
Read only

amit_khare
Active Contributor
0 Likes
503

welcome to SDN.

Concatenate sy-datum4(2) '/' sy-datum6(2) '/' sy-datum+0(4) into v_date.

Regards,

Amit

Reward all helpful replies.

4 REPLIES 4
Read only

Former Member
0 Likes
503

Hi,

use the Function module CONVERT_DATE_TO_EXTERNAL

example:

CALL FUNCTION 'CONVERT_DATE_TO_EXTERNAL'

EXPORTING

DATE_INTERNAL = VLDAT

IMPORTING

DATE_EXTERNAL = DATE

EXCEPTIONS

DATE_INTERNAL_IS_INVALID = 1

OTHERS = 2

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

regards,

keerthi

Message was edited by:

keerthi kiran varanasi

Read only

amit_khare
Active Contributor
0 Likes
504

welcome to SDN.

Concatenate sy-datum4(2) '/' sy-datum6(2) '/' sy-datum+0(4) into v_date.

Regards,

Amit

Reward all helpful replies.

Read only

Former Member
0 Likes
503

Hi,

Welcome to SDN.

You can use offset.


data: wa_date(10).

concatenate sy-datlo+4(2) '/' sy-datlo+6(2) '/' sy-datlo(4) into wa_date.

write: /wa_date.

Regards,

Ferry Lianto

Read only

Former Member
0 Likes
503

Hi,

you have option called edit-mask go for that statement you will get the date format what ever you want.

hope it will help u.