Python time localtime() Method


Contents

Description

Pythom time technique localtime() is alike to gmtime() except it adapts number of seconds to restricted time. If secs is not offered or None, the present time as revisited by time() is utilized. The dst ensign is set to 1 when DST applies to the agreed time.

Syntax

Following is the syntax for localtime() method:

time.localtime([ sec ])

Parameters

  • sec − These are the number of seconds to be converted into structure struct_time representation.

Return Value

This method does not return any value.

Example

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

#!/usr/bin/python
import time

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

When we run above program, it produces following result:

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

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



Navigation
Tutorial
Tutorial
Tutorial