I posted 2 pictures that contains, the code, and the error. How do i solve this and compare the current time and the time on the database?
Asked
Active
Viewed 101 times
0
-
Check this http://stackoverflow.com/questions/25714670/typeerror-cant-compare-datetime-timedelta-to-float – Agam Banga May 18 '17 at 09:50
-
@AgamBanga which ones do i convert, the one i got from the database or derp? and how do i do it? – fry bell May 18 '17 at 10:32
-
there are two approaches:- one is what you are currently doing. In this case, you need to convert both object to seconds & compare it. Another Approach is if you have `datetime` field in `uclass` table . simple query will suffice to get the results – Agam Banga May 18 '17 at 10:40
-
@AgamBanga the one I'm currently doing doesnt work if I use > or < on the argument, however = works fine. If I opted to change the format of `time` into `datetime`, how do i compare it from the one i got from `derp`(just the time)? – fry bell May 18 '17 at 13:20
1 Answers
0
What i found that works for my problem is to convert the time i got from row[4] into str()
which i found from:
Python format timedelta to string