Latest web development tutorials

Python time ctime () method

description

Python time ctime () function takes a timestamp (in seconds float) into time.asctime () form. If the parameter is not given or is None, when will default time.time () as a parameter. It acts asctime (localtime (secs)).

grammar

ctime () method syntax:

time.ctime([ sec ])

parameter

  • sec - number of seconds to be converted to a string of time.

return value

This function has no return value.

Examples

The following example shows ctime () function to use:

#!/usr/bin/python
import time

print "time.ctime() : %s" % time.ctime()

The above example output is:

time.ctime() : Tue Feb 17 10:00:18 2013