1

Working with pytz in Python. I have a datetime objects that I am trying to convert to different timezones. When printing the UTC Offset, I am not getting a -0500. What's the reason for this?

original_utc = datetime.datetime(1900,6,6,10,40, tzinfo=pytz.timezone('UTC'))

in_eastern = lesson.astimezone(pytz.timezone('America/New_York'))



print("UTC time: ", original_utc.strftime("%Y:%m:%d %H:%M:%S %Z %z"))
print("----------")
print("EST time", in_eastern.strftime("%Y:%m:%d %H:%M:%S %Z %z"))

Gives me:

UTC time:  1900:06:06 10:40:00 UTC +0000
----------
EST time 1900:06:06 05:44:00 LMT -0456
abhivemp
  • 932
  • 6
  • 24

0 Answers0