Dev HelpersOpen library
← Back

Convert a timezone

Convert a timezone. A self-contained example using the Python standard library.

Open this example in the interactive library

Source code

from datetime import datetime, timezone
from zoneinfo import ZoneInfo
print(datetime(2026, 10, 22, 15, tzinfo=timezone.utc).astimezone(ZoneInfo('America/Toronto')).isoformat())

Sample output

2026-10-22T11:00:00-04:00