I have data that is the UTC offset and the UTC time. Given that, is it possible in Python to get the user's local timezone (mainly to figure if it is DST etc. probably using pytz), similar to the function in PHP timezone_name_from_abbr
?
For example:
If my epoch time is 1238720309, I can get the UTC time as:
>>> d = datetime.utcfromtimestamp(1238720309)
>>> print d + dt.timedelta(0,-28800) #offset for pacific I think
2009-04-02 17:04:41.712143
This is correct except it is PDT right now, so it should be:
2009-04-02 18:04:41.712413
I need to get the timezone to use in pytz to figure out if it is daylight saving, I think?