This is a migrated thread and some comments may be shown as answers.

GridDateTimeColumn Excel Export Format

2 Answers 137 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Scott McNeany
Top achievements
Rank 1
Scott McNeany asked on 29 Apr 2011, 08:38 PM
Hello,

I am using Telerik.Web.UI version 2010.2.826.35, and I have a grid with the column shown below. When I export to Excel, I would expect the formatting of the column to be "Short Date" or at least match the date format string that I've defined. However, the cells in Excel show a formatting of "Custom" with the formatting string of "m/d/yyy h:mm". 

This is not the desired behavior since we have clients all over the world and the 'slash' divider means something different in different parts of the world. Instead, we would like it formatted as a Date cell and then it would pick up the local formatting of that user.

<telerik:GridDateTimeColumn
DataField="trans_dt"
HeaderText="Purchase Date"
SortExpression="trans_dt"
UniqueName="PurchaseDate"
CurrentFilterFunction="StartsWith"
AutoPostBackOnFilter="true"
Display="true"
DataFormatString="{0:dd-MMM-yyyy}">
<HeaderStyle Width="130px" />
</telerik:GridDateTimeColumn>


Please let me know if anything can be done.

Thank you,

Scott McNeany

2 Answers, 1 is accepted

Sort by
0
Princy
Top achievements
Rank 2
answered on 30 Apr 2011, 06:21 AM
Hello Scott,

Check out the following forum thread which discussed the same.
Export Excel DateTime Field Display Seconds.

Thanks,
Princy.
0
Scott McNeany
Top achievements
Rank 1
answered on 30 Apr 2011, 02:23 PM
Princy,

As always, thank you for the prompt response.

I think you sent me the incorrect link. That link URL does not match the title.
I did find the post you were discussing by way of Google on the title, so no worries. I just wanted to post the correct link for future viewers.
http://www.telerik.com/community/forums/aspnet-ajax/grid/export-excel-datetime-field-display-seconds.aspx.

I will review the documentation for number formats described in this post and let you know if I have any problems.

Thank you,

Scott
Tags
Grid
Asked by
Scott McNeany
Top achievements
Rank 1
Answers by
Princy
Top achievements
Rank 2
Scott McNeany
Top achievements
Rank 1
Share this question
or