I’m looking for a method of determining when DST starts or ends for a given timezone in a Python script I’m working on.
I know pytz can convert the UTC dates I’m working into localtime, and will take DST into account, however for this particular application I need to know the point of the changeover.
Any suggestions?
You could have a look to the
_utc_transition_timesmemberof the timezone you’re using.It will give you the list of the DST change dates (start and end of DST).
According to the code of tzinfo.py
So if you mix the
_utc_transition_timeswith_transition_infoyou will grab all your needed informations, date, time and offset to apply 😉