Pythom time method asctime() converts a tuple or struct_time representing a time as returned by gmtime() or localtime() to a 24-character string of the following form: 'Tue Feb 17 23:21:05 2009'.
Following is the syntax for asctime() method −
time.asctime([t]))
t − This is a tuple of 9 elements or struct_time representing a time as returned by gmtime() or localtime() function.
This method returns 24-character string of the following form: 'Tue Feb 17 23:21:05 2009'.
The following example shows the usage of asctime() method.
#!/usr/bin/python import time t = time.localtime() print "time.asctime(t): %s " % time.asctime(t)
When we run above program, it produces following result −
time.asctime(t): Tue Feb 17 09:42:58 2009