I have a web app that captures date / time via a JS script and calculates seconds since epoch in UTC format - ex 134250270000. In the backend we have a Python script that fetches data from DB but has date / time stored in number of seconds since epoch in PST format. There is always a difference of seconds between UTC and PST if counted from epoch.
Is there any method by which I can convert the UTC seconds since to epoch to PST seconds since epoch? We need to take a note of daylight changes in PST timezone also?
EDIT::
I have the seconds since epoch in UTC format:
1342502700
I found that I get the sum in seconds between UTC and local standard time via:
>>> time.timezone / 3600
8
So If I add 1342502700 to time.timezone:
>>> print 1342502700 + time.timezone
1344153600
Will it always give me PDT / PST times correctly?
EDIT::
Maybe this is the correct one:
>>> import time
>>> offset = time.timezone if (time.daylight == 0) else time.altzone
>>> offset / 60 / 60
7
time.daylight will be non-zero if daylight savings is currently in effect.