Python Cannot Concatenate 'str' And 'datetime.timedelta' Objects June 25, 2024 Post a Comment I have this code, but I got an error and could not find a soulution to the problem. I was trying to get a time and then plus i hour becuase i live in europe. Here is my code: plus_Solution 1: Convert your string to datetime object.Ex:import datetime plus_one_hour = datetime.datetime.strptime("21:00:00", "%H:%M:%S") + datetime.timedelta(hours=2) print(plus_one_hour.strftime("%H:%M:%S")) CopyOutput:23:00:00Copy Share Post a Comment for "Python Cannot Concatenate 'str' And 'datetime.timedelta' Objects"
Post a Comment for "Python Cannot Concatenate 'str' And 'datetime.timedelta' Objects"