from date/time string to seconds since epoch

wittempj@hotmail.com martin.witte at gmail.com
Wed Jul 6 15:23:35 EDT 2005


You can calculate the offset of where you are like this:

martin at ubuntu:~ $ python
Python 2.4.1 (#2, Mar 30 2005, 21:51:10)
[GCC 3.3.5 (Debian 1:3.3.5-8ubuntu2)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
py> import time
py> offset = 0
py> if time.daylight:
py.     offset = time.altzone
py. else:
py.     offset = time.timezone
py.
py> print offset
-7200
py>

You can use time.time() to get the UTC time, then add the offset.




More information about the Python-list mailing list