I am trying to run this code:
if initial_hour_obj.hour == 8:
print (initial_hour_obj)
initial_hour_obj.replace(hour = 10)
print (initial_hour_obj)
2022-03-23 08:30:00
2022-03-23 08:30:00
but the replace method wont work. If I try to print a message after the if statement to see if my datetime obj hour is equal to the integer 8, it prints my message, so the evaluation is working, and if I try the .replace() method outside of the if, it also works, any ideas why they wont work together?
thanks