Export Excel DateTime Field Display Seconds

4 posts, 0 answers
  1. Felipe Saldana
    Felipe Saldana avatar
    62 posts
    Member since:
    Jan 2009

    Posted 21 Jul 2010 Link to this post

    I have a grid and I am exporting to excel.

    On the web page, I have a DateTime field that displays using the following format:

    <telerik:GridBoundColumn HeaderText="Message Date" DataField="messageDate" UniqueName="messageDate" SortExpression="messageDate" ShowSortIcon="false" DataFormatString="{0:MM/dd/yyyy hh:mm:ss tt}" DataType="System.DateTime" ></telerik:GridBoundColumn>

    On the web page the seconds get displayed. When I export the grid to Excel the seconds are no longer displayed.
    The field is displayed on the spreadsheet like the following : 07/21/10 10:06 AM.

    If I click on the cell and look at the data for the cell the seconds are indeed there.
    How do I force Excel to use my specific DateTime format?

    Thanks for the help.

  2. Daniel
    Daniel avatar
    4949 posts

    Posted 22 Jul 2010 Link to this post

    Hello Felipe,

    It depends on the Excel format that is used in your scenario - ExcelML or HTML.

    I recommend that you examine the following links:
    ExcelML export
    (Number formats; Custom styles)

    Word/Excel export (HTML-based)
    (Number formats / Formulas section)

    Best regards,
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. ArtiCut
    ArtiCut avatar
    5 posts
    Member since:
    Nov 2016

    Posted 06 Nov 2016 in reply to Daniel Link to this post

    What about Xlsx format? ( ExcelFormat .Xlsx)
  4. Daniel
    Daniel avatar
    4949 posts

    Posted 07 Nov 2016 Link to this post


    Here is the corresponding topic for the XLSX format:
    XLSX and DOCX - Formatting

    Telerik by Progress
    Check out the new UI for ASP.NET Core, the most complete UI suite for ASP.NET Core development on the market, with 60+ tried-and-tested widgets, based on Kendo UI.
Back to Top