Python Time ctime() Method
Python Time ctime() Method
Description
The ctime() method converts the number of seconds since the epoch to a string representing local time. If secs is not provided or is None, the current time as returned by time() is used. This function is equivalent to asctime(localtime(secs)). The ctime() method does not use localization information.
Syntax
The syntax of the ctime() method is as follows:
time.ctime([sec])
Parameters
- sec − This is the number of seconds to be converted to a string representation.
Return Value
This method does not return any value.
Example
The following example shows the usage of the ctime() method.
import time
print ("ctime : ", time.ctime())
When running the above program, the following output is produced:
ctime : Thu Apr 20 00:04:00 2023