datetime to iso python code example
Example 1: python datetime to string iso 8601
from datetime import datetime
my_date = datetime.now()
print(my_date.isoformat())
Example 2: python datetime to string iso 8601
from datetime import datetime
my_date = datetime.now()
print(my_date.strftime('%Y-%m-%dT%H:%M:%S.%f%z'))
Example 3: python datetime from timestamp utc
dt_object = datetime.fromtimestamp(timestamp)