cancel
Showing results for 
Search instead for 
Did you mean: 

ABAP code to convert date and time

Former Member
0 Kudos

Hi Experts,

Can any one provide an ABAP code to convert date and time from *090826235150.3786170 to 2009/08/26 23.51.50. Do you want to split the fields into two or can i manage in one field.it would be helpful for me in reporting.

Please do the needful for me

Regards,

Venugopal.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

hi

u have to declare 2 fields.

Declaration depends on how u want the fields do u want to have '/' in between . In that case u should declare 2 char fields.

date type c length 10.

time type c length 8.

else u can use standard fields sy-datum. (Eg : date type sy-datum. and time type sy-timlo )

say ur original field is Timestamp.

concatenate '20' Timestamp(2) '/' Timestamp2(2) '/' Timestamp4(2) into date.

else if u r using sydatum, concatenate '20' Timestamp+2(6) into date.

and similar code for Time as well.

Also could u elaborate on ur reqmt. If it is jus for display u can use char, else if u need to create variables / restriction go 4 sy-datum n sy-timlo.

thanks,

aparna