title: Exporting to Excel - Make DateTime columns into Date
body: <p>I've got an Export to Excel function in my application.
  There are no problems with the program itself, but when exporting data, it shows <code>DateTime</code> values as <code>dd/MM/yyyy 00:00:00</code>, which, when displaying them on a <code>DataGridView</code> before importing, shows empty cells in some places.</p>
  
  <p>I need to adapt my export code to remove the time portion of the data, and just display the date. When I highlight the cell in Excel, I am formatting it to be 'Date' of format <code>dd/MM/yyyy</code>.</p>
  
  <p>How can I do this programatically?</p>
  
  <p>my code</p>
  
  <pre><code>Dim xlapp As Excel.Application
  Dim xlWorkbook As Excel.Workbook
  Dim xlWorksheet As Excel.Worksheet
  Dim misvalue As Object = Reflection.Missing.Value
  
  xlapp = New Excel.Application
  xlWorkbook = xlapp.Workbooks.Add(misvalue)
  xlWorksheet = xlWorkbook.Sheets.Add
  xlWorksheet.Name = "SupplierInformation"
  xlWorksheet.Cells.NumberFormat = "@"
  
    For k As Integer = 1 To dgvExport.Columns.Count
      xlWorksheet.Cells(1, k) = dgvExport.Columns(k - 1).HeaderText
    Next
  
    For i = 0 To dgvExport.RowCount - 1
      For j = 0 To dgvExport.ColumnCount - 1
         xlWorksheet.Cells(i + 2, j + 1) = dgvExport(j, i).Value.ToString
       Next
     Next
  
  xlWorksheet.Columns.AutoFit()
  </code></pre>