title: Get the latest date
body: <p>I have an array that I call $data.</p>
  
  <p>I want to get the earliest dates from the $data array for each host in my csv file. The user will input a host and it will find the earliest date it was modified. </p>
  
  <pre><code>    Hostname    LastModified
      HD           9/8/2012
      LOG          9/15/2004
      NETMAN       12/25/2004
      NETMAN       5/5/2015
      LOG          1/4/2013
      LOG          6/6/2011
  </code></pre>
  
  <p>So if they input LOG, I want it to give me the earliest date.</p>
  
  <pre><code>    Created on  9/15/2004
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code> $data= import-csv ".\Earliest Date Template.csv" 
   $Hostname=Read-Host "Please enter Host Name"
   $data | Foreach-Object {$_."Last Modified" = [DateTime]$_."Last Modified"; $_} | Group-Object Hostname| Foreach-Object {$_.Group | Sort-Object LastModified | Select-Object -First 1}
  </code></pre>