Python time gmtime() Method



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.


Following is the syntax for gmtime() method:

time.gmtime([ sec ])


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

Return Value

This method does not return any value.


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

import time

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

When we run above program, it produces 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.