troubleshooting

What is the easiest way to convert a timestamp from UTC to EDT?

James Piette is looking for a simple method to convert a timestamp from UTC to EDT.

Ja

James Piette

Asked on Jan 11, 2024

  • One way to convert a timestamp from UTC to EDT is by using the pytz library in Python.
import pytz
from datetime import datetime

utc_time = datetime.utcnow()
edt_timezone = pytz.timezone('America/New_York')
edt_time = utc_time.astimezone(edt_timezone)
print(edt_time)
Jan 11, 2024Edited by