title: How to compare two dates: one from file modification date, other from sql table in Python?
body: <p>I need to compare the modification date of a file with a date that comes from a table, but the method I'm using is not the best, can you help?</p>
  <p>Right now I'm doing this:</p>
  <pre><code>modificationTime = time.strftime('%d/%m/%Y', time.localtime(os.path.getmtime(file))) 
  
  max_load_date = (engine.execute(&quot;SELECT MAX(load_date) from %s where filename = '%s'&quot; % (table, os.path.basename(file)))).first()[0]
  
  print(max_load_date &lt; modificationTime)
  
  </code></pre>
  <p>it's flawless because 23/05/2022 is bigger than 22/05/2022, but if 23/05/2022 it's smaller than 24/04/2022.</p>
  <p>I've tried to convert the date coming from the database, but failed...</p>
  <p>I've tried something like this</p>
  <pre><code>time.strftime('%d/%m/%Y', max_load_date)
  
  </code></pre>
  <p>but it doesn't work</p>