newvem / pytz

MIT License
58 stars 12 forks source link

Pytz is giving (UTC+11) instead of (UTC+8) for Antarctica/Casey timezone #14

Open Keshavgoyal788 opened 2 years ago

Keshavgoyal788 commented 2 years ago

I am using pytz library for importing the coordinated universal time for different timezones. I have tried fetching the UTC time for Antarctica/Casey timezone which expectedly should return (UTC+8) for the current time period but is returning (UTC+11). Antarctica/Casey timezone has the DST enabled for 3hrs and for which time varies between (UTC+8) and (UTC+11). Casey Station changes between UTC+8 in the winter season and UTC+11 in the summer season. The Australian station's time changes line up—for the most part—with the switch to Daylight Saving Time (DST) in Australia. So, when Tasmania sets the clocks forward one hour for DST to UTC+11, Casey sets its clocks forward three hours to UTC+11. Sometimes, these dates are moved depending on supply boats or flights to the station, so time changes in Casey are often labeled preliminary.

Time Changes in Casey Over the Years Daylight Saving Time (DST) changes do not necessarily occur on the same date every year.

Time zone changes for: Recent/upcoming years

Year Date & Time Abbreviation Time Change Offset After 2021 Sun, 14 Mar, 00:00 CAST (not changed) -3 hours (TZ change) UTC+8h Sun, 3 Oct, 00:01 CAST (not changed) +3 hours (TZ change) UTC+11h 2022 Sun, 13 Mar, 00:00 CAST (not changed) -3 hours (TZ change) | Probable date UTC+8h Sun, 2 Oct, 00:01 CAST (not changed) +3 hours (TZ change) | Preliminary date UTC+11h 2023 — 2025 No known changes, UTC +11 hours all of the period

Aravindms369 commented 2 years ago

I am also facing the same issue with pytz timezone of Antarctica/Casey Please provide some help in same.

>>> from datetime import datetime
>>> import pytz
>>> timezone= 'Antarctica/Casey'
>>> splitted_timezone = datetime.now(pytz.timezone(timezone)).strftime('%z')
>>> offset_value = [splitted_timezone[1:3], splitted_timezone[3:5]]
>>> print(offset_value)
['11', '00']