Convert Datetime with Timezone to ISO 8601 date string
Tags: #python #datetime #timezone #iso8601 #string #conversion
Description: This notebook will demonstrate how to convert a datetime with timezone to an ISO 8601 date string.
References:
from datetime import datetime
import pytz
date_time
: datetime with timezone
date_time = datetime(2020, 8, 1, 12, 0, 0, tzinfo=pytz.timezone("Europe/Paris"))
print(date_time)
iso_date_string = date_time.isoformat()
print(iso_date_string)
Last modified 1mo ago