SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


How do you properly export time values to Excel?


How do you properly export time values to Excel?

Author
Message
Rod
Rod
SSCertifiable
SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)SSCertifiable (6.9K reputation)

Group: General Forum Members
Points: 6876 Visits: 2173
My users wanted to have the date/time field in a table split into the date part and the time part. I thought that the TimeValue() function would do the job, and it appeared to, at least within the report. However, when exporting it to Excel the time value is awful. It's some huge negative number with the time value there. I've read somewhere (can't remember where, sorry) that the TimeValue() function puts the date part of the datetime to some date way in the past, and that's how it doesn't get displayed in the report. But man, does that play havoc when exporting to Excel! The same place where I saw that article also said that you could "fix" that by changing the base date for the spreadsheet in Excel to something like 1/1/1903. Believe me, my users aren't that sophisticated. They don't want to have to do anything like that, and certainly have no idea as to how to do that, but they demand that the exported Excel spreadsheet will be in the correct time format, and that that column be sortable. So how do I resolve this problem?

Right now we're using SSRS 2005, but in 2 weeks we'll install SQL Server 2012, so will that take care of it?

Kindest Regards,Rod
Connect with me on LinkedIn.
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search