title: How to check and change the DateTime Format from UK to US in an excel sheet using C#?
body: <p>I have  .Net code which retrieves a set of data/records in a GridView and renders it to the User. There are a couple of columns comprising of dates. When, i export this data into the excel having users regional settings set to that of UK, DateTime format for the columns remains fine. But, when it gets exported to the computers having US regional settings, the columns in excel formats changes and anything exceeding 12 in the 'DD' gets left-aligned in the excel column as it is Month for the US settings. In short, i wanted to first check and then change the format as per the individual user's region settings. I'v been scratching my head with Culture's but with no output. Appreciate any help on this? Here is what i'm trying to do:</p>
  
  <pre><code>enter code here
  </code></pre>
  
  <p>protected void gvReportHidden_OnRowDataBound(object sender, GridViewRowEventArgs e)
      {
          CultureInfo currentCulture = CultureInfo.CurrentCulture;</p>
  
  <pre><code>    if (currentCulture.NativeName.Equals("en-UK"))
          {
              e.Row.Cells[8].Text = DateTime.Parse(e.Row.Cells[8].Text).ToString("dd/MM/yyyy");
              e.Row.Cells[9].Text = DateTime.Parse(e.Row.Cells[9].Text).ToString("dd/MM/yyyy");
          }
          else
          {
              e.Row.Cells[8].Text = DateTime.Parse(e.Row.Cells[8].Text).ToString("MM/dd/yyyy");
              e.Row.Cells[9].Text = DateTime.Parse(e.Row.Cells[9].Text).ToString("MM/dd/yyyy");
          }
  }
  </code></pre>