cancel
Showing results for 
Search instead for 
Did you mean: 

Date format

Former Member
0 Kudos

can anyone send me code to replace '/' in date '1/12/200' by '.'

thanks

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

<b>TRANSLATE v_date using '/.'.</b>

REPORT ychatest.

DATA : v_date(10) VALUE '1/12/2000'.

TRANSLATE v_date using '/.'.

write : v_date.

Message was edited by:

Chandrasekhar Jagarlamudi

Former Member
0 Kudos

data: w_len1 type i.

data: w_ofst1 type i.

data w_len type i.

data: d_date(10).

d_date = '1/1/2006'.

w_len1 = strlen( d_date ).

do.

if d_date+w_ofst1(1) EQ '/'.

d_date+w_ofst1(1) = '.' .

w_len = w_len + 1.

endif.

w_ofst1 = w_ofst1 + 1.

if w_len eq '2'.

exit.

endif.

enddo.

or use translate command.

Answers (4)

Answers (4)

Former Member
0 Kudos

HI USE THIS CODE.THIS WIL BE USEFUL

MOVE SY-DATUM+6(2) TO MY_DATE.

MOVE '/' TO MY_DATE+2.

MOVE SY-DATUM4(2) TO MY_DATE3.

MOVE '/' TO MY_DATE+5.

MOVE SY-DATUM0(4) TO MY_DATE6.

SY-TVAR0 = MY_DATE.

former_member588853
Active Contributor
0 Kudos

hi,

lets take we have v_date = 02/06/2007.

<b>REPLACE ALL OCCURRENCES OF '/' IN V_date WITH '.'.</b>

rewaards if useful,

regards,

nazeer

former_member188685
Active Contributor
0 Kudos

REPORT ZTEST_TC_TEST2.

data: v_date(10) type c.

v_date = '01/02/2007'.

replace all occurrences of '/' in v_date with '.'.

write v_date.

Former Member
0 Kudos

Hi,

Use Replace '.' with '/' into l_f_date.

Reward if helpful.

Regards,

Umasankar.