title: Comparing two timestamp strings in Python
body: <p>I have JSON file which has timestamps in it.The timestamp in the format shown below.</p>
  
  <p>timestamp1  <code>Fri Mar 27 15:25:24 NZDT 2015</code> </p>
  
  <p>timestamp2  <code>Fri Mar 27 15:23:01 NZDT 2015</code></p>
  
  <p>Between the above two timestamps above timestamp1 is at a later time than timestamp2. </p>
  
  <p>How can I compare these timestamps in a python program,so that among hundreds of timestamps extracted from a JSON file I get the latest timestamp.I have written the program to extract the timestamp people.I don't know how to compare them.</p>
  
  <pre><code># Import the os module, for the os.walk function
  import os
  import json
  
  # Set the directory you want to start from
  rootDir = '/Workspace/events_parts'
  for dirName, subdirList, fileList in os.walk(rootDir):
      print('Found directory: %s' % dirName)
      for fname in fileList:
          print('\t%s' % fname)
          fname='events_parts/'+fname
          with open(fname, 'r+') as f:
              json_data = json.load(f)
              ts = json_data['Timestamp']
              print(ts)
  </code></pre>