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

Former Member
0 Likes
1,141

i need to convert the date.. want to convert from YYYYMMDD to DD.MM.YYYY

is there any functional module available for that?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,082

Hi,

I am not sure that there is any function modules. But use the following code as.

data : date like sy-datum,

var(10).

concatenate date6(2) '.' date4(2) '.' date+0(4) into var.

write : /1 var.

Regards,

Sankar.

10 REPLIES 10
Read only

Former Member
0 Likes
1,083

Hi,

I am not sure that there is any function modules. But use the following code as.

data : date like sy-datum,

var(10).

concatenate date6(2) '.' date4(2) '.' date+0(4) into var.

write : /1 var.

Regards,

Sankar.

Read only

Former Member
0 Likes
1,082

Hi,

Try using FM CONVERSION_EXIT_PDATE_OUTPUT.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
1,082

Hi,

Use Write statement using EDIT MASK .you can achieve the result.

WRITE .... EDIT MASK .....

ex:

data : ldate type sy-datum,

wdate type char10.

ldate = sy-datum.

write ldate TO wdate USING EDIT MASK '__.__.____'.

WRITE : / wdate.

Read only

Former Member
0 Likes
1,082

Hi Suresh,

you have FM's to convert the date in the system format to internal format.

But you can achieve the same with simple statements.

data l_date(10) type c.

concatenate <yourdate_variable>6(2) '.' <yourdate_variable>4(2) '.' <yourdate_variable>+0(4) into l_date.

then you shall be left with l_date which holds date in your required format.

Reward points if this helps,

Kiran

Read only

Former Member
0 Likes
1,082

HI,

use FM CONVERSION_EXIT_PDATE_OUTPUT

Regards,

S.Nehru.

Read only

Former Member
0 Likes
1,082

Hi,

Lets say

DAT1 is in format YYYYMMDD

and you want DAT2 should be in DD.MM.YYYY

You can use concatenate statement like below.

CONCATENATE DAT16(2) '.' DAT14(2) '.' DAT1+0(4) TO DAT2.

Regards,

Mayank

Read only

Former Member
0 Likes
1,082

hi,

CONVERSION_EXIT_PDATE_OUTPUT

Read only

Former Member
0 Likes
1,082

Data : gv_datum type sy-datum value sy-datum,

gv_date(10) type c.

constant : gc_dot type c value '.'.

concatenate gv_datum6(2) gc_dot gv_datum4(2) gc_dot gv_datum+0(4)

into gv_date.

write gv_date.

Regards

Sagar

Read only

Former Member
0 Likes
1,082

hi use this ...

parameters: p_dat(10) .

data: dat1(4),

dat2(2),

dat3(2),

date(10).

dat1 = p_dat+0(4).

dat2 = p_dat+4(2).

dat3 = p_dat+6(2).

concatenate dat3 dat2 dat1 into date separated by '.'.

write:/ date.

regards,

venkat

Read only

Former Member
0 Likes
1,082

Instead of FM using one string concatenation u can do the same functionality.

concatenate date6(2) '.' date4(2) '.' date(4) into date1

Reward pts for useful answers.