Over a million developers have joined DZone.

Time Module

·

>>> from time import time, localtime, strftime
>>> time()             # seconds since the epoch
1135156165.5569999
>>> localtime()[0:3]   # date
(2005, 12, 21)
>>> localtime()[3:6]   # time
(16, 9, 27)
>>> strftime("%d %b %Y %H:%M:%S", localtime())
'21 Dec 2005 16:09:27'
>>>
See more detail in python documentation
Topics:

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}