Dealing with ISO 8601 dates in Python
·
Kiran Gangadharan
For those who don’t know what the ISO 8601 format is, you can read about it here.
To create an ISO 8601 timestamp in Python, do:
|
|
The ’ Z ’ added to the timestamp indicates that the timezone is UTC.
To parse a ISO 8601 timestamp and generate a datetime object, do:
|
|
Alternatively, you could also generate the object using:
|
|