I'm a complete beginner, I have a test mysql db set up. I am currently trying to check if the backup start time listed in the database is before 12pm on the current day. The time was entered into the table using the following:
UPDATE Clients SET backup_started=NOW() WHERE id=1;
What I am currently trying is:
now = datetime.datetime.now()
today12am = now.replace(hour=0, minute=0, second =0,)
dbu.cursor.execute('SELECT id, company_name, backup_started,\
backup_finished FROM Clients WHERE backup_started>' + today12am)
data = dbu.cursor.fetchone()
print (data)
I understand that it is trying to compare a datetime.datetime to a string and this is where it is having problems. My question is what is the best way to accomplish this?
error:
TypeError: cannot concatenate 'str' and 'datetime.datetime' objects