title: How to sort timestamp list?
body: <p>I have a list of timestamp(long) in which I have to sort list base on time or list added.</p>
  
  <p>I have tried and searched but its now working.</p>
  
  <pre><code> Collections.sort(vehicles, new Comparator&lt;VehicleListModel.Vehicle&gt;() {
                  @Override
                  public int compare(VehicleListModel.Vehicle o1, VehicleListModel.Vehicle o2) {
                      try {
                          DateFormat format = new SimpleDateFormat("MM-dd-yyyy hh:mm:ss");
                          return format.parse(o1.getCreated()).compareTo(format.parse(o2.getCreated()));
                      } catch (Exception e) {
                          e.printStackTrace();
                          return 0;
                      }
                  }
              });
              customerListAdapter.notifyDataSetChanged();
  </code></pre>
  
  <p>its not working then I tried
  <a href="https://stackoverflow.com/questions/13241251/timestamp-to-string-date">this</a> but this <code>Date(timeStamp)</code> is deprecated</p>
  
  <p>please help</p>