Excel Export - Date Formatting Based Upon Culture

2 posts, 0 answers
  1. JosephB
    JosephB avatar
    1 posts
    Member since:
    Aug 2007

    Posted 27 May 2014 Link to this post

    I have a Grid in which dates are always displayed in MM/dd/yyyy format.  However, when we export the grid to Excel, we want the date format to be culture-specific.  For example, a US-based user would see 5/27/2014 for today's date while a UK-based user would see 27/05/2014.

    Is there a simple way to accomplish this?  Setting the Culture property of the Grid did not do the trick.  I eventually solved the problem by putting some code into the Grid's ExportCellFormatting event in which I convert the Cell.Text to a DateTime (from a string) and subsequently cast the DateTime to a string for the Culture that I retrieve from Request.UserLanguages.

    Thanks in advance!
  2. Kostadin
    Kostadin avatar
    1733 posts

    Posted 30 May 2014 Link to this post

    Hi Joseph,

    Thank you for contacting us.

    Could you please let me know which export format you are using? I prepared a small sample where I used the HTML based on format which is the default one and the date is exported based on the culture. I attached the sample to thread so could you please give it a try and let me know how it differs from your real setup?

    I am looking forward to your reply.


    Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

Back to Top