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.

    Felipe
  2. Daniel
    Admin
    Daniel avatar
    4946 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,
    Daniel
    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. UI for ASP.NET Ajax is Ready for VS 2017
  4. ArtiCut
    ArtiCut avatar
    5 posts
    Member since:
    Nov 2016

    Posted 06 Nov in reply to Daniel Link to this post

    What about Xlsx format? ( ExcelFormat .Xlsx)
  5. Daniel
    Admin
    Daniel avatar
    4946 posts

    Posted 07 Nov Link to this post

    Hello,

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

    Regards,
    Daniel
    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