examplethe calendardatetimeand time modules objects of type datetime datetime are usually created programmaticallywhereas objects that hold utc date/times are usually received from external sourcessuch as file timestamps here are some examplesimport calendardatetimetime moon_datetime_a datetime datetime( moon_time calendar timegm(moon_datetime_a utctimetuple()moon_datetime_b datetime datetime utcfromtimestamp(moon_timemoon_datetime_a isoformat(returns' : : moon_datetime_b isoformat(returns' : : time strftime("% -% -%dt% :% :% "time gmtime(moon_time)the moon_datetime_a variable is of type datetime datetime and holds the date and time that apollo landed on the moon the moon_time variable is of type int and holds the number of seconds since the epoch to the moon landing--this number is provided by the calendar timegm(function which takes time_struct object returned by the datetime datetime utctimetuple(functionand returns the number of seconds that the time_struct represents (since the moon landing occurred before the unix epochthe number is negative the moon_datetime_b variable is of type datetime datetime and is created from the moon_time integer to show the conversion from the number of seconds since the epoch to datetime datetime object the last three lines all return identical iso -format date/time strings the current utc date/time is available as datetime datetime object by calling datetime datetime utcnow()and as the number of seconds since the epoch by calling time time(for the local date/timeuse datetime datetime now(or time mktime(time localtime()algorithms and collection data types |the bisect module provides functions for searching sorted sequences such as sorted listsand for inserting items while preserving the sort order this module' functions use the binary search algorithmso they are very fast the heapq module provides functions for turning sequence such as list into heap-- collection data type where the first item (at index position is always the smallest itemand for inserting and removing items while keeping the sequence as heap unfortunately for windows usersthe datetime datetime utcfromtimestamp(function can' handle negative timestampsthat istimestamps for dates prior to january