0

I have two datetimes:

When I subtract one from the other and print the timedelta, which is > 1 day, I get this:

>>> 5 days, 23:33:32.265709

But if the timedelta is < 1 day, I get this:

>>> 4:35:16.744049

What I need is the number of days to be at the start of the output even if it is 0 (ideally in HH format) so that I can take that number and carry out logic on it, e.g. if it is greater than 7 days then do this.

martineau
  • 112,593
  • 23
  • 157
  • 280
  • 1
    that is just the built-in string representation of the timedelta type. If you want a different one, write your own formatter, see [Format timedelta to string](https://stackoverflow.com/q/538666/10197418). – FObersteiner Feb 25 '22 at 17:17

0 Answers0