I have a datetime variable and I want to substract just 1 hour from it. I tried to do it with below code but I received the following error: TypeError: unsupported operand type(s) for -: 'str' and 'datetime.timedelta'
from datetime import datetime, timedelta
cur_time = datetime.now()
cur_time_f = cur_time.strftime("%Y-%m-%dT%H:%M:%SZ")
print(cur_time_f)
>> 2020-09-15T09:07:44Z
nueve = cur_time_f - timedelta(hours=1)
print(nueve)
My expected output:
>> 2020-09-15T08:07:44Z