SoFunction
Updated on 2024-12-13

Using the gmtime method to manipulate date and time in Python

gmtime() method converts the calendar element to a struct_time in UTC where the flag value of dst is always 0 to indicate the time in seconds. If seconds or None is not set, the time returned is the current time().
vocabulary

The following is the syntax of the gmtime() method:

([ sec ])

parameters

  • sec -- This is the number of seconds converted to the struct struct_time to represent it.

return value

This method does not return any value.
(for) instance

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

#!/usr/bin/python
import time

print "() : %s" % ()

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

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