View Single Post
Old Mar 7th, 2006, 11:57 PM   #10
hydroxide
Programmer
 
Join Date: Apr 2005
Posts: 73
Rep Power: 4 hydroxide is on a distinguished road
Quote:
Originally Posted by Sane
I was wondering if there was an easier way to do the following:
import time

def timestr_to_epoch(timestr):
    localtime = time.strptime(timestr, "%a %b %d %H:%M:%S %Y")
    return time.mktime(localtime)

print timestr_to_epoch(time.ctime())
print time.time()
--OH.
hydroxide is offline   Reply With Quote