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

Problem with time stamp conversion

Former Member
0 Likes
1,767

Hi All,

I am using the below code to convert timestamp to date and time , its working fine when i print it with write statement .

But i want to convert and pass the time and date with format to excel sheet , but its it taking again as string not in date time format .

please see the below code .

time_stamp = 20030309043000.

CONVERT TIME STAMP time_stamp TIME ZONE tz

INTO DATE dat TIME tim.

*WRITE: /(10) dat, (8) tim .

please suggest .

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,037

Now that you've converted your time stamp to date (type d) and time (type t), convert them into alphnumeric fields like you want or tell excel what is in that column, since Excel isn't telepathic...and doesn't always know what we sent it....

data: date10(10) type c.

time8(8) type c.

write dat to date10 mm/dd/yyyy. "converts type d to user's specific date setting (not necessarily mm/dd/yyyy).

concatenate tim(2)

tim+2(2)

tim+4(2)

into time8 separated by ':'.

I do wish that I understood the fascination with Excel....when we have such marvelous tools to work with inside SAP or BW.

6 REPLIES 6
Read only

Former Member
0 Likes
1,037

Hi,

Not sure I got this... can't you simply use a 'WRITE TO' when filling your internal table fields before downloading, so that your strings are correctly formatted and interpreted as such by excel?

Kr,

Manu.

Read only

Former Member
0 Likes
1,038

Now that you've converted your time stamp to date (type d) and time (type t), convert them into alphnumeric fields like you want or tell excel what is in that column, since Excel isn't telepathic...and doesn't always know what we sent it....

data: date10(10) type c.

time8(8) type c.

write dat to date10 mm/dd/yyyy. "converts type d to user's specific date setting (not necessarily mm/dd/yyyy).

concatenate tim(2)

tim+2(2)

tim+4(2)

into time8 separated by ':'.

I do wish that I understood the fascination with Excel....when we have such marvelous tools to work with inside SAP or BW.

Read only

0 Likes
1,037

Hi ,

It worked out .. Thanks to BreakPoint .....

Read only

former_member203501
Active Contributor
0 Likes
1,037

Hi ,

use the function module IB_CONVERT_FROM_TIMESTAMP for your requirement, speciy the time stamp and time zone.

Read only

0 Likes
1,037

I think venkat's solution is the perfect one. u can use IB_CONVERT_FROM_TIMESTAMP and pass time stamp and region and get time and date .

I pblm solved close the thread...

Read only

0 Likes
1,037

Hi ,

I already tried the function module suggested by Venkat , Yes it will convert it to proper fomate but again the same issue when I am passing it to excel its taking it as string .