I have data that are UTC offset and UTC time. Given this, is it possible in Python to get a custom local time zone (mainly to determine if it is a DST, etc., probably using pytz), similar to a function in PHP timezone_name_from_abbr?
For example:
If the time of my era is 1238720309, I can get the UTC time as:
>>> d = datetime.utcfromtimestamp(1238720309)
>>> print d + dt.timedelta(0,-28800)
2009-04-02 17:04:41.712143
This is correct, except for PDT right now, so it should be:
2009-04-02 18:04:41.712413
I need to get the time zone for use in pytz to find out if it is daylight saving time, I think?
Jmat
source
share