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

Former Member
0 Likes
972

Hi SDN's

I have a date in format DD.MM.YYYY

how can i convert it to DD.MM.YY

and again from DD.MM.YY format i need to convert back to DD.MM.YYYY format.

Please suggest as to how to do it?

Regards

Pratyusha

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
895

Hi

You can do the offset for the year like

data v_year(2) type N.

v_year = date+8(2).

concatenate day month v_year separated by full stop(.).

but this waorks fine for a particular decade. say it it is 1900 -1999 then Ok or

2000 -2999 it's Ok.

Reward points if useful

Regards

Anji

6 REPLIES 6
Read only

Former Member
0 Likes
895

Hi

just Do Masking.....

For first task u can do like this,....

data: date type dats,

date1 type dats.

concatenate date0(2) date2(2) date+4(2) into date1.

For second you have already it in your old format..Or do the same masking like first task...

Hope this will help u..

Reward All helpfull answers...

Read only

Former Member
0 Likes
895

hi,

<b>Pls chk this new correct code.</b>



REPORT  ZSHA_TEST.

data : out_date(10) type c,
in_date(10) type c,
v1(2) type c,
v2(2) type c,
v3(2) type c.

in_date = '10.02.2007'.

*take variables V1, V2, V3.
V1 = in_date+8(2).
V2 = in_date+3(2).
V3 = in_date+0(2).

Concatenate V3 V2 V1 into out_date separated by '.'.

write out_date.

Rgds

Reshma

Message was edited by:

Reshma Alumadathil

Read only

Former Member
0 Likes
895

Hi,

first you move it to char field and use SPLIT commannd at '.' and concatenate to other fileld in your required way.

sudheer.A

Read only

Former Member
0 Likes
896

Hi

You can do the offset for the year like

data v_year(2) type N.

v_year = date+8(2).

concatenate day month v_year separated by full stop(.).

but this waorks fine for a particular decade. say it it is 1900 -1999 then Ok or

2000 -2999 it's Ok.

Reward points if useful

Regards

Anji

Read only

Former Member
0 Likes
895

Hi,

In order to look at the different Date settings or formats available in SAP, you can go to System on the main screen and click on User Profile and then click on Own Data.On the new screen click on the Defaults tab and then you can view the different date formats available.

But since you want something which is not already present in SAP, what you can do is , use the offset and the length function like in order to convert the date from format DD.MM.YYYY to DD.MM.YY , you can write date+8(2) which would truncate the first 2 digits of the year field.But before doing this, you can store the original date in some variable in order to reconvert it back to the original form.

Hope this answer is of any help to you.

Regards,

Puneet.

Read only

Former Member
0 Likes
895

Solved on own