title: Replace data in first column of CSV
body: <p>I have a CSV with many columns, and the data in the first column are dates but in the wrong format.  I am able to select just the first column and reformat the dates, but I cannot figure out how to save the new data to the existing CSV without overwriting all the other data.</p>
  
  <pre><code>$File = "File.csv"
  $Content = Get-Content $File
  $timestamp = @()
  $timestamp += '"' + "timestamp" + '"'
  $timestamp += $Content | Foreach { $_.Split(",") | select -first 1 } | select -skip 1 -last 10000 | where {$_ -notmatch "timestamp"} | foreach {($_).Substring(1,$_.Length-2)} | foreach {get-date ($_).ToString() -Format s} | foreach {'"' + $_ + '"'}
  </code></pre>
  
  <p>Before:</p>
  
  <pre><code>"timestamp"
  "17-Dec-2014 07:00:00 AM"
  "17-Dec-2014 07:15:00 AM"
  "17-Dec-2014 07:30:00 AM"
  "17-Dec-2014 07:45:00 AM"
  "17-Dec-2014 08:00:00 AM"
  </code></pre>
  
  <p>After:</p>
  
  <pre><code>"timestamp"
  "2014-12-17T07:00:00"
  "2014-12-17T07:15:00"
  "2014-12-17T07:30:00"
  "2014-12-17T07:45:00"
  "2014-12-17T08:00:00"
  </code></pre>