logo

Python Time Ctime() Method


Show

Description

Python time scheme ctime() changes a time stated in seconds since the era to a string in place of local time. If secs is not offered or None, the present time as revisited by time() is utilized. This purpose is corresponding to asctime(localtime(secs)). Locale information is not used by ctime().

Syntax

Following is the syntax for ctime() method -

time.ctime([ sec ])

Parameters

  • sec - These are the number of seconds to be converted into a string representation.

Return Value

This method does not return any value.

Example

The following example shows the usage of ctime() method.

#!/usr/bin/python
import time

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

When we run the above program, it produces the following result:

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

Here at Intellinuts, we have created a complete Python tutorial for Beginners to get started in Python.