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 Conversion

Former Member
0 Likes
718

Hi, I need to convert a date like this:

2001-07-24T00:00:00.0000000+02:00

in SAP format:

20010724

How can I do it?

There is a function module? THANKS

1 ACCEPTED SOLUTION
Read only

former_member302911
Active Participant
0 Likes
687

Hi,

can try this simple code:



DATA A TYPE STRING VALUE '2001-07-24T00:00:00.0000000+02:00'.
DATA VA_DATA LIKE SY-DATUM.

REPLACE ALL OCCURENCES OF '-' IN A WITH ''.
VA_DATA = A(8).
WRITE VA_DATA.

Angelo.

5 REPLIES 5
Read only

former_member302911
Active Participant
0 Likes
688

Hi,

can try this simple code:



DATA A TYPE STRING VALUE '2001-07-24T00:00:00.0000000+02:00'.
DATA VA_DATA LIKE SY-DATUM.

REPLACE ALL OCCURENCES OF '-' IN A WITH ''.
VA_DATA = A(8).
WRITE VA_DATA.

Angelo.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
687

if your format consists of first 10 characters as date always then u can write your logic.

say text is your variable.

extract like text+0(9).

pass it to FM CONVERT_DATE_TO_INTERNAL to convert it

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
687

if your format consists of first 10 characters as date always then u can write your logic.

say text is your variable.

extract like text+0(9).

pass it to FM CONVERT_DATE_TO_INTERNAL to convert it

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
687

if your format consists of first 10 characters as date always then u can write your logic.

say text is your variable.

extract like text+0(9).

pass it to FM CONVERT_DATE_TO_INTERNAL to convert it

Read only

Former Member
0 Likes
687

Hi,

try this TZ_GLOBAL_TO_LOCAL.

here u pass date and time ,u'll get according to ur format.

Regards,

Ranjitha.