Python: get days, hours, minutes and seconds form timestamp
import datetime
duration = datetime.timedelta(seconds=1823723) # 21 days, 2:35:23
days, seconds = duration.days, duration.seconds # (21, 9323)
hours = seconds // 3600 # 2
minutes = (seconds % 3600) // 60 # 35
seconds = (seconds % 60) # 23