How would I get Arrow to return the difference in hours between two timestamps?
Here's what I have:
difference = arrow.now() - arrow.get(p.create_time())
print(difference.hour)
p.create_time()
being the timestamp of the create time of a currently running process.
Returns:
AttributeError: 'datetime.timedelta' object has no attribute 'hour'
Edit: I don't want the total time in all three formats, I want it as a remainder eg. "3 days, 4 hours, 36 minutes" not "3 days, 72 hours, 4596 minutes"
Given 2 dates that are formatted from a string to
arrow
type.The difference is a
datetime.timedelta
data type.And results in:
To get it formatted such that you would have
D days, H hours, M minutes, S seconds
you would get the days separately, and then usingdivmod
function get the other information.The result would be: