Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

Python time ctime() method

Python time ctime() method


Description

The Python time ctime() function converts a timestamp (a floating-point number counted in seconds) into the form of time.asctime(). If no argument is given or it is None, time.time() is used by default. It is equivalent to asctime(localtime(secs)).

Syntax

ctime() method syntax:



time.ctime([ sec ])

Parameters

Return Value

This function has no return value.

Example

The following example shows how to use the ctime() function:



#!/usr/bin/python

import time



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

The output of the above example is:



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