tags:

views:

275

answers:

3

I've looked at the Python Time module and can't find anything that gives the integer of how many seconds since 1970 as PHP does with time().

Am I simply missing something here or is there a common way to do this that's simply not listed there?

+15  A: 
import time
print int(time.time())
David Grant
+5  A: 

time.time() does it, but it might be float instead of int which i assume you expect. that is, precision can be higher than 1 sec on some systems.

SilentGhost
+2  A: 

I recommend reading "Date and Time Representation in Python". I found it very enlightening.

itsadok