views:

125

answers:

1

How can I return the current time of the local machine?

This question was answered:

>>import time
>>time.time()
>>1269888125.177495

>>int(time.time())
>>1269888125
+2  A: 

Do you mean this: time.time()?

From the docs:

Return the time as a floating point number expressed in seconds since the epoch, in UTC

>>> import time
>>> time.time()
1269884900.480978
>>> 
ChristopheD
Thank you! Is there any way to not return the decimal digits?
ensnare
make it integer by wrapping it in an `int()` call
ChristopheD
int(time.time())
Larry
Great. Thank you!!
ensnare