title: usort Date Assistance
body: <p>I am trying, unsuccessfully, to sort my list by one of my template fields ($fields[3]) which is a text input field with a date inside it. The problem is that because of the format of the date it will not sort correctly because I guess it is just comparing numbers.</p>
  
  <p>I think I need to change the dateformat before sorting occurs but have so far failed to do this.</p>
  
  <p>I am trying to use the usort function like so (field 3 is the one with the date in which is formatted like this dd/mm/yyyy),</p>
  
  <pre><code>if (!function_exists('do_sort')) {
      function do_sort($a, $b) {
          return $a-&gt;fields[3] &gt; $b-&gt;fields[3];
      }}
  
  $data = $params['data'];
  usort($data, 'do_sort');
  $smarty-&gt;assign('sorted', $data);
  </code></pre>
  
  <p>This sorts the data but as before, because I haven't changed anything, not in the correct order. Can anyone help me reformat the date prior to sorting?</p>
  
  <p>Many thanks</p>
  
  <p>Chris</p>