YouTip LogoYouTip

Python3 Att Time Mktime Html

# Python3.x Python3 time mktime() Method * * * ## Description The Python time mktime() function performs the opposite operation of gmtime() and localtime(). It takes a struct_time object as an argument and returns a floating-point number representing time in seconds. If the input value is not a valid time, it will raise an OverflowError or ValueError. ## Syntax The syntax for the mktime() method is: time.mktime(t) ## Parameters * t -- A struct_time object or a full 9-element tuple representing time. ## Return Value Returns a floating-point number representing time in seconds. ## Example The following example demonstrates the usage of the mktime() function: #!/usr/bin/python3import time t = (2016, 2, 17, 17, 3, 38, 1, 48, 0) secs = time.mktime( t )print ("time.mktime(t) : %f" % secs)print ("asctime(localtime(secs)): %s" % time.asctime(time.localtime(secs))) The output of the above example is: time.mktime(t) : 1455699818.000000 asctime(localtime(secs)): Wed Feb 17 17:03:38 2016
← Python3 JsonPython3 Multithreading β†’