Friday 15 July 2016

Python: time.asctime([t]): Convert time to readable format

time.asctime([t])
Converts struts_tuple to a string of the form 'Mon Nov  9 14:36:20 2015'. Argument ‘t’ is optional, if t is not provided, the current time as returned by localtime() is used.

>>> import time
>>> time.asctime()
'Mon Nov  9 21:08:13 2015'
>>> 
>>> t=time.gmtime()
>>> time.asctime(t)
'Mon Nov  9 15:38:21 2015'



Previous                                                 Next                                                 Home

No comments:

Post a Comment