Application Development 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: 

Display Reverse Date

Former Member
0 Kudos

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

JozsefSzikszai
Active Contributor
0 Kudos

use offset:

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

Former Member
0 Kudos

112008 = x.

200811 = y.

u have to use the offset concept.

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

Former Member
0 Kudos

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

Former Member
0 Kudos

Hi Reshma,

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

former_member156446
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Do like......


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

 SHIFT var CIRCULAR by 2 places.

It will give u 200811 as a result.