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 Conversion Function Modules YYYYMMDD to MM/DD/YYYY

Former Member
0 Likes
5,301

Hi,

I have a requirement to Conver the Dats from format: YYYYMMDD into the Format : MM/DD/YYYY. Can you please suggest me a suitabble Standard Function Module if exists? If not please suggest me a solution for this data conversion.

Thanks,

Rajan.SA

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
2,126

Hi,

You can use WRITE FORMATING.

Here the sample code:


DATA: BEGDA       TYPE TEXT10,
      ENDDA       TYPE SY-DATUM.

  WRITE SY-DATUM TO BEGDA MM/DD/YYYY.
  WRITE SY-DATUM TO ENDDA MM/DD/YYYY.

And of course you can use other format, like:

... DD/MM/YY

... MM/DD/YY

... DD/MM/YYYY

... MM/DD/YYYY

... DDMMYY

... MMDDYY

... YYMMDD

Or you can use concatenate statement:


    concatenate SY-DATUM+4(2) SY-DATUM+6(2)
    SY-DATUM(4) INTO BEGDA separated by '/'.

Regards,

3 REPLIES 3
Read only

Former Member
0 Likes
2,127

Hi,

You can use WRITE FORMATING.

Here the sample code:


DATA: BEGDA       TYPE TEXT10,
      ENDDA       TYPE SY-DATUM.

  WRITE SY-DATUM TO BEGDA MM/DD/YYYY.
  WRITE SY-DATUM TO ENDDA MM/DD/YYYY.

And of course you can use other format, like:

... DD/MM/YY

... MM/DD/YY

... DD/MM/YYYY

... MM/DD/YYYY

... DDMMYY

... MMDDYY

... YYMMDD

Or you can use concatenate statement:


    concatenate SY-DATUM+4(2) SY-DATUM+6(2)
    SY-DATUM(4) INTO BEGDA separated by '/'.

Regards,

Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
2,126

Use function module CONVERT_DATE_TO_EXTERNAL. This will convert the date to the user specific format. So if your user specific format is mm/dd/yyyy, then this is all you need.

Regards,

RIch Heilman

Read only

Former Member
0 Likes
2,126

I used FM CONVERT_DATE_TO_EXTERNAL to convert the date format into MMDDYY check it if it helps.