I have a timestamp like this: 2021-01-03T01:59:00Z
.
How can I write a subtraction to get the timestamp a day earlier than the one indicated in ISO 8601 format?
Thanks!
CodePudding user response:
You can use delta for take away 1 day
your_timestamp = '2021-01-03T01:59:00Z'
result = datetime.datetime.strptime(your_timestamp, "%Y-%m-%dT%H:%M:%S%z") - datetime.timedelta(days=1)