title: Sort string array containing time in format '09:00 AM'?
body: <p>I am trying to sort my array.</p>
  
  <p>The array consists of data in time format.</p>
  
  <p>Array:</p>
  
  <pre><code>'9:15 AM', '10:20 AM', '02:15 PM'
  </code></pre>
  
  <p>How should I sort it ?</p>
  
  <p>I'm getting this data usig json service &amp; using it to list events in jquery mobile's listview . but I want to sort events by time .</p>
  
  <p><strong>UPDATE:
  HOW I SORTED DATA FROM JSON BY BOTH DATE AND TIME:</strong></p>
  
  <p>For my particular problem of sorting data got using json by date &amp; time I done like this :</p>
  
  <pre><code>$.getJSON(serviceURL + 'read.php?month_no='+month_no, function(data) {
  
  
          events = data.data;
  
          events.sort(function(a,b){
              a = new Date(a.event_date+' '+a.event_time);
              b = new Date(b.event_date+' '+b.event_time);
              return a&lt;b?-1:a&gt;b?1:0;
         });
  
  
  }); 
  </code></pre>