datetime python isoformat from string 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'))