Python version of PHP function time ()

I looked through the Python time module and cannot find anything that gives an integer number of seconds since 1970 as PHP does with time ().

Am I just missing something here or is there a general way to do this that just isn't listed there?

+3
source share
3 answers
import time
print int(time.time())
+22
source

time.time () does this, but there may be a float instead of an int, which I assume you expect. that is, accuracy can be higher than 1 second on some systems.

+5
source

I recommend reading Date and Time Representation in Python . I found this very helpful.

+3
source

Source: https://habr.com/ru/post/1702472/


All Articles