Some Bits: Nelson's weblog

Python time functions by type

Python deals with time in three formats: a float (seconds since epoch), a struct_time tuple, or a string. This is all well documented but the conversions confuse me. Here’s another way to look at it:

 float -> tuple   gmtime,localtime
 float -> string  ctime           

 tuple -> float   mktime          
 tuple -> string  strftime,asctime

string -> tuple   strptime