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

Python time asctime() method

Python time asctime() method


Description

The Python time asctime() function accepts a time tuple and returns a readable 24-character string in the form "Tue Dec 11 18:07:14 2008" (Tuesday, December 11, 2008, 18:07:14).

Syntax

asctime() method syntax:



time.asctime([t]))

Parameters

Return Value

Returns a readable 24-character string in the form "Tue Dec 11 18:07:14 2008" (Tuesday, December 11, 2008, 18:07:14).

Example

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



#!/usr/bin/python

import time



t = time.localtime()

print "time.asctime(t): %s " % time.asctime(t)

The output of the above example is:



time.asctime(t): Tue Feb 17 09:42:58 2009