string in iso format to datetime 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'))