right_now = datetime.datetime.now()
one_hour_before = ?????
How can I use right_now to get one_hour_before?
right_now = datetime.datetime.now()
one_hour_before = ?????
How can I use right_now to get one_hour_before?
right_now = datetime.datetime.now()
one_hour_before = right_now - datetime.timedelta(hours=1)
You need to use datetime.timedelta
like so:
right_now = datetime.datetime.now()
one_hour_before = right_now - datetime.timedelta(hours = 1)