1
I am trying to compare the current date with the date of the last entry of my mysql database:
sql2 = "SELECT created_at FROM tempaverage WHERE created_at IN (SELECT max(created_at) FROM tempaverage)"
cursor.execute(sql2)
current = strftime("%Y-%m-%d %H:%M:%S", gmtime())
for (created_at) in cursor:
diff = current-created_at
print diff
But it doesn’t return anything when I do the print diff
because it comes out in the exception and if you do the print created_at
the value is > (datetime.datetime(2015, 3, 4, 11, 45, 3),)
How can I compare the dates?