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: 

date conversion

Former Member
0 Kudos

Hi all,

I want to convert my date format. From DD/MM/YYYY to DD/MM/YY. I am doing this using concatenation. Can any body tell me how to do this using 'WRITE TO'. Or please suggest me if any Function Module exists.

Thanks.

Munagala.

7 REPLIES 7

kiran_k8
Active Contributor
0 Kudos

Praveen,

Try this Fn Module

DATE_CONV_EXT_TO_INT - user formatted date is converted to system date

K.Kiran.

former_member194669
Active Contributor
0 Kudos

Hi,


data: lv_date(8)   type c.
write sy-datum to lv_date DD/MM/YY.

lv_date contains the date with  DD/MM/YY

Former Member
0 Kudos

Hi,

try this code

data: char type sy-datum.

char = sy-datum.

data: var(10) type c.

write char to var using edit mask '__/__/____'.

write:/ var.

clear: var.

concatenate sy-datum6(2) sy-datum4(2) sy-datum+2(2) into var.

skip.

write var using edit mask '__/__/__'.

thanks & regards,

Venkatesh

Former Member
0 Kudos

Hi Praveena,

Anyways you are concatenating into a variable use that variable.

Concatenate date10(2) date12(2) date1+6(2) into date2.

Use date2.

Regards,

Ravi G

Former Member
0 Kudos

Hi Praveen,

This is very simple...

Use like this:

WRITE d_temp TO field2 DD/MM/YY.

Thanks and Best Regards,

Vikas Bittera.

Former Member
0 Kudos

Hi Praveen,

This is very simple...

Use like this:

WRITE d_temp TO field2 DD/MM/YY. d_temp being a field of type d.

Thanks and Best Regards,

Vikas Bittera.

Former Member
0 Kudos

If it is a character field do like this...

DATA : DATE(10) VALUE '22/07/2007',

OUTDATE(8).

WRITE : DATE+0(6) TO OUTDATE(6),

DATE8(2) TO OUTDATE6(2).

WRITE : / OUTDATE.

But if it is a date field (type d or like sy-datum) do like this

DATA : IDATE LIKE SY-DATUM.

IDATE = SY-DATUM.

WRITE : / IDATE DD/MM/YY.

reagrds

shiba dutta