title: Sorting an array of dates
body: <p>I have created an array from a CSV of date values and now need to be able to sort them so that I can then get the latest date from the array.</p>
  
  <p>I have tried:</p>
  
  <pre><code>Array.Sort()
  </code></pre>
  
  <p>but this doesn't sort correctly, I suppose because the array values are strings, any body got any ideas??</p>
  
  <p>Thanks for any help.</p>
  
  <p><strong>CODE USED TO CREATE ARRAY</strong></p>
  
  <pre><code>'array string exampel: "19/07/2012,23/07/2012,23/07/2012,19/07/2012,25/07/2012"
  Dim ArrDates As Array = ArrDates .Split(",")
  </code></pre>
  
  <p><strong>SOLUTION</strong></p>
  
  <pre><code>Dim ArrAgentsReportCheck As Array = AgentsReportCheck.Split(",")
  
  Dim ArrDates As New List(Of Date)
  For i As Integer = 0 To ArrAgentsReportCheck.Length - 1
      ArrDates.Add(ArrAgentsReportCheck(i))
  Next
  
  ArrDates.Sort()
  Dim LatestDate As Date = ArrDates.Max()
  </code></pre>