title: usort On String to Date Converted
body: <p>I'm trying to take a string in the format of <em>mdY H:i</em> and sort it in an array. My code for the sort is:</p>
  <pre><code>    function orderDates($items) {
      //Sort them. Latest one first
      usort($items, function ($a, $b) {
          $a = date('dmY H:i', strtotime($a));
          $b = date('dmY H:i', strtotime($b));
  
          if ($a == $b) {
              return 0;
          }
          return ($a &gt; $b) ? -1 : 1;
      });
  
      return $items;
  }
  </code></pre>
  <p>I have a test case of:</p>
  <pre><code>public function test_orderDates() {
      $items = [&quot;09082020 00:00&quot;, &quot;12072020 00:00&quot;, &quot;14062020 00:00&quot;, &quot;17052020 00:00&quot;, &quot;21062020 00:00&quot;, &quot;24052020 00:00&quot;, &quot;26072020 00:00&quot;];
  
      $rv = $this-&gt;cleanupFolder-&gt;orderDates($items);
  
      $this-&gt;assertNotNull($rv);
      $this-&gt;assertEquals(7, sizeOf($rv));
  
      $this-&gt;assertEquals(&quot;09082020 00:00&quot;, $rv[0]);
      $this-&gt;assertEquals(&quot;26072020 00:00&quot;, $rv[1]);
      $this-&gt;assertEquals(&quot;12072020 00:00&quot;, $rv[2]);
      $this-&gt;assertEquals(&quot;21062020 00:00&quot;, $rv[3]);
      $this-&gt;assertEquals(&quot;14062020 00:00&quot;, $rv[4]);
      $this-&gt;assertEquals(&quot;24052020 00:00&quot;, $rv[5]);
      $this-&gt;assertEquals(&quot;17052020 00:00&quot;, $rv[6]);
  }
  </code></pre>
  <p>I expect it to be in that order but it just comes back in the same order. I don't understand what I've done wrong.</p>