def time_difference(date1, date2):
 later = (mktime(date1.timetuple()) + (date1.microsecond / 1000000.0))
 earlier = (mktime(date2.timetuple()) + (date2.microsecond / 1000000.0))
 return (later - earlier)

def time_difference ( date1 , date2 ) : later = ( mktime ( date1 . timetuple ( ) ) + ( date1 . microsecond / 1000000.0 ) ) earlier = ( mktime ( date2 . timetuple ( ) ) + ( date2 . microsecond / 1000000.0 ) ) return ( later - earlier )
returns the time difference in seconds between the given two datetime objects .