This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# This function prints the difference between two python datetime objects | |
# in a more human readable form | |
# | |
# Adapted from: http://www.chimeric.de/blog/2008/0711_smart_dates_in_python | |
def humanize_date_difference(now, otherdate=None, offset=None): | |
if otherdate: | |
dt = otherdate - now | |
offset = dt.seconds + (dt.days * 60*60*24) |