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

Former Member
0 Likes
894

Hi Everybody,

I want to change the Date format like MM-DD-YYYY to YYYY-MM-DD using the Function Module "CONVERT_DATE_TO_INTERN_FORMAT ". I tried using this function module. But It doesn't work. Anubody help me.

Thanks in advance.

8 REPLIES 8
Read only

Former Member
0 Likes
846

use Fm

CONVERT_DATE_TO_INTERNAL

YYYYMMDD "system internal format

it will not be

YYYY-MM-DD .

regards,

vijay

Read only

Simha_
Product and Topic Expert
Product and Topic Expert
0 Likes
846

Hi,

check this,

data: yymmdd(6) type c value '070109'.

data: yyyymmdd type sy-datum.

data: mmddyy(6) type c.

mmddyy0(2) = yymmdd2(2).

mmddyy2(2) = yymmdd4(2).

mmddyy4(2) = yymmdd0(2).

call function 'CONVERT_DATE_TO_INTERN_FORMAT'

exporting

datum = mmddyy

dtype = 'DATS'

importing

  • ERROR =

idate = yyyymmdd

  • MESSG =

  • MSGLN =

.

write:/ yyyymmdd.

Cheers,

SImha.

Read only

Former Member
0 Likes
846

Hi Vijay,

Try this FM <b>CONVERT_DATE_TO_INTERNAL</b>

reward if useful.

Read only

Former Member
0 Likes
846

Hi,

U can convert

DATA: v_year(4) type c,
v_month(2) type c,
v_days(2) type c.
*
SELECT-options: FROMDATE FOR SY-DATUM
            DEFAULT SY-DATUM.

 v_month = fromdate-low+4(2).
 v_year = fromdate-low+0(4).
 v_days = fromdate-low+6(2).
 CONCATENATE v_year '-' v_month '-' v_days  INTO fromdate-low.

Hope u can try this way.

Read only

Former Member
0 Likes
846

Hi,

Use the following FM:

DATE_CONV_EXT_TO_INT - user formatted date is converted to system date

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
846

What do you want to do with this YYYY-MM-DD date? What data type has the MM-DD-YYYY date?

Read only

Former Member
0 Likes
846

vijay,

one way is

1.ws_year = sy-datum+0(4).

ws_mon = sy-datum+4(2).

ws_day = sy-datum+6(2).

concatenate ws_year ws_mon ws_day into ws_date separated by '.' .

pls. mark if useful

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
846

Hi

Use FM:

CONVERT_DATE_TO_INTERNAL

which can convert the date of sap formatt to user defined formatt.

Regards,

kumar