GridDateTimeColumn Excel Export Format

3 posts, 0 answers
  1. Scott McNeany
    Scott McNeany avatar
    9 posts
    Member since:
    Mar 2010

    Posted 29 Apr 2011 Link to this post

    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. Princy
    Princy avatar
    17421 posts
    Member since:
    Mar 2007

    Posted 30 Apr 2011 Link to this post

    Hello Scott,

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

    Thanks,
    Princy.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Scott McNeany
    Scott McNeany avatar
    9 posts
    Member since:
    Mar 2010

    Posted 30 Apr 2011 Link to this post

    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
Back to Top