How can I take the current time in seconds in Python? I was using calendar.timegm(time.gmtime())
but I'm not sure if this given value is in seconds?
Asked
Active
Viewed 5,288 times
1
-
Possible duplicate of [How to get current time in Python](http://stackoverflow.com/questions/415511/how-to-get-current-time-in-python) – AdrienW Jul 27 '16 at 07:34
-
1Try `time` module. `import time; time.time()` – Joey.Chang Jul 27 '16 at 07:57
2 Answers
0
Use:
from datetime import datetime
sec = int(datetime.utcnow().total_seconds()) % 86400

Vaibhav Bajaj
- 1,934
- 16
- 29