Latest web development tutorials

Python time localtime () method

description

Python time localtime () function is similar gmtime (), the role of the timestamp format for the local time. If the parameter is not entered sec, places the current time as transfer standards. DST (Daylight Savings Time) flag (-1, 0 or 1) if it is daylight saving time.

grammar

localtime () method syntax:

time.localtime([ sec ])

parameter

  • sec - converted to the number of seconds time.struct_time type object.

return value

This function has no return value.

Examples

The following example shows the localtime () function to use:

#!/usr/bin/python
import time

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

The above example output is:

time.localtime() : (2009, 2, 17, 17, 3, 38, 1, 48, 0)