Latest web development tutorials

Python time asctime () method

description

Python time asctime () function takes a time tuple and returns a readable form for the character "Tue Dec 11 18:07:14 2008" (December 11, 2008 Tuesday 18:07:14) 24 characters string.

grammar

asctime () method syntax:

time.asctime([t]))

parameter

  • t - tuples 9 element or a function of time by gmtime () or localtime () return value.

return value

Returns a readable form for the string "Tue Dec 11 18:07:14 2008" (December 11, 2008 Tuesday 18:07:14) 24 characters.

Examples

The following example shows asctime () function to use:

#!/usr/bin/python
import time

t = time.localtime()
print "time.asctime(t): %s " % time.asctime(t)

The above example output is:

time.asctime(t): Tue Feb 17 09:42:58 2009