Skip to content

Timezone conversion returns values that differ from timezone offset #2

Description

@priyaranjan-tokachichu

I have asked this question on stackoverflow.com, and did not get any response. Link to my question is here http://stackoverflow.com/questions/41056110/python-pytz-timezone-conversion-returns-values-that-differ-from-timezone-offset.
The code I used is below
`import pytz
import tzlocal
from datetime import datetime
usest=tzlocal.get_localzone()#My local zone is US/Eastern. I could directly use that here as pytz.timezone("US/Eastern")
dt=datetime(1900,1,1,0,0,0)
dt_aware=usest.localize(dt,is_dst=True)
utcdate=dt_aware.astimezone(pytz.utc)
print (utcdate)
1900-01-01 04:56:00+00:00

dt1=datetime(2016,1,1,0,0,0)
dt1_aware=usest.localize(dt1,is_dst=True)
utcdate1=dt1_aware.astimezone(pytz.utc)
print (utcdate1)
2016-01-01 05:00:00+00:00`
Why is there a difference in minutes for these two date conversions? Could this be a bug?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions