I'm trying to compare the current date with the last record date 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 does not return anything when I make print diff
because it exits the exception, and if it does print created_at
the value is > (datetime.datetime(2015, 3, 4, 11, 45, 3),)
How can I compare dates?