I tried using as_timestamp and as_datetime… but bothing, I get errors that I can use the operato - with str, other error was TypeError: can't subtract offset-naive and offset-aware datetimes in condition (a)
That works indeed, but the problem is because it calculates the time in the operatio too, and even if the dates are different by 1 day, because it takes in account the hour, it says the difference is 0 days
I adapted that template from a similar one I posted elsewhere. In the process I misplaced the location of a parenthesis (as Didgeridrew quickly identified). I have corrected the example posted above.
Because timedelta() stores its values as a combination of days and seconds, you have to combine those into a single unit and do a little math to get whole hours.