logo

Python Time Gmtime() Method


Show

Description

Pythom time process gmtime() exchanges a time uttered in seconds since the era to a struct_time in UTC in which the DST pennant is always zero. If secs is not offered or None, the existing time as returned by time() is utilized. gmtime() system of Time module is employed to exchange a time expressed in seconds while the era to a time. struct_time object in UTC in which tm_isdst characteristic is always 0. To exchange the agreed time in seconds since the epoch to a time. struct_time object in local time, time.

Syntax

Following is the syntax for gmtime() method:

time.gmtime([ 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 gmtime() method.

#!/usr/bin/python
import time

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

When we run the above program, it produces the following result:

time.gmtime() : (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.