title: Convert Datatable's date-type column to short date on output - VB.Net
body: <p>Experts, please help...</p>
  
  <p>I have a datatable where I load in data from a SQL Server database with tens of thousands of records and I have a procedure which outputs the entire datatable to a delimited text file.</p>
  
  <p>My procedure to do so has code along the following lines:</p>
  
  <pre><code>For Each dtRow As DataRow In dtToWrite.Rows
       File.WriteLine(String.Join(strDelimitter, dtRow.ItemArray.Select(Function(Field) Field.ToString)))
  Next 
  </code></pre>
  
  <p>Basically creating a delimited string from each datarow from my datatable using the string.join function.</p>
  
  <p>Now, my problem is that I am pulling in Date values from SQL Server and so the final output has, for the date columns, values that look like:</p>
  
  <p><b>"9/30/2012  12:00:00 AM"</b></p>
  
  <p>Whereas I only want it to show:</p>
  
  <p><strong>"9/30/2012"</strong></p>
  
  <p>What is the best way to get my data to output ONLY the date portion from the datatable?</p>
  
  <p>Thanks! </p>