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

Display Reverse Date

Former Member
0 Likes
1,820

I have extracted date in format MMYYYY.Now I want to display it in reverse.

ex. 112004. I want to display it in format 200411.

the variable which I m using is of type character.

How should I do it?

6 REPLIES 6
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,036

use offset:

CONCATENATE source+2(4) source(2) INTO target.

Read only

Former Member
0 Likes
1,036

112008 = x.

200811 = y.

u have to use the offset concept.

y = x2(4) + x0(2).

Read only

Former Member
0 Likes
1,036

hi Reshma,

THe simplest way would be to use Offsets and Concatenate statement

For eg.

v_date = '20081014'.

something like:

CONCATENATE v_date6(2) '.' v_date4(2) '.' v_date+0(4) INTO v_new_date

hope it may help u.

thanks

Sachin

Read only

Former Member
0 Likes
1,036

Hi Reshma,

U can do as above also or use SET DATE MASK command.

Read only

former_member156446
Active Contributor
0 Likes
1,036

Data i_date TYPE sy-datum.

Data e_date(10).

i_date = '23082009'.

CONCATENATE i_date+0(2) '.'

i_date+2(2) '.'

i_date+4(4) INTO e_date.

There is no other way to do this otherwise use FM module CONVERT_DATE_TO_EXTERNAL.

there might be some setting issue some times for that

Go to System==> User Profile ==>Own data==>Defaults==>Date Format.

Read only

Former Member
0 Likes
1,036

Do like......


DATA:
    VAR(6) TYPE C VALUE '112008'.

 SHIFT var CIRCULAR by 2 places.

It will give u 200811 as a result.