Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sum up Time difference
#7
(Apr-05-2023, 06:34 PM)deanhystad Wrote: Did you try to sum timedelta objects? I would assume you can sum objects if the objects can be added. You can add timedelta objects.

https://docs.python.org/3/library/dateti....timedelta

Pay close attention to what Gribouillis did. In particular this:
sum(d, timedelta(seconds=0))
Why do you think there is a timedelta(seconds=0) after the list of times? Isn't that 0 seconds? Why is that there? Maybe looking at the documentation for sum will clear things up.

https://docs.python.org/3/library/functions.html#sum
I kind of understand the idea but I do not see how I can use it with the time delta I have as "Time Difference = 0:08:13-<class 'datetime.timedelta'>"
It makes me sad Confused but we are not on the same Python planet yet brother....
Need to put more work into it.

Thank you!
Reply


Messages In This Thread
Sum up Time difference - by tester_V - Apr-05-2023, 05:15 AM
RE: Sum up Time difference - by Gribouillis - Apr-05-2023, 06:19 AM
RE: Sum up Time difference - by tester_V - Apr-05-2023, 06:04 PM
RE: Sum up Time difference - by deanhystad - Apr-05-2023, 07:31 PM
RE: Sum up Time difference - by deanhystad - Apr-05-2023, 06:34 PM
RE: Sum up Time difference - by tester_V - Apr-05-2023, 08:33 PM
RE: Sum up Time difference - by snippsat - Apr-05-2023, 06:55 PM
RE: Sum up Time difference - by deanhystad - Apr-05-2023, 08:52 PM
RE: Sum up Time difference - by tester_V - Apr-05-2023, 09:43 PM
RE: Sum up Time difference - by deanhystad - Apr-06-2023, 03:06 AM
RE: Sum up Time difference - by Gribouillis - Apr-06-2023, 06:54 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  time difference bettwenn logs enkliy 14 1,154 Nov-21-2023, 04:51 PM
Last Post: rob101
  Hard time trying to figure out the difference between two strings carecavoador 2 721 Aug-16-2023, 04:53 PM
Last Post: carecavoador
  How to get indices of minimum time difference Mekala 1 2,209 Nov-10-2020, 11:09 PM
Last Post: deanhystad
  How to calculate time difference between each row of dataframe in seconds Mekala 1 2,632 Jul-16-2020, 12:57 PM
Last Post: Larz60+
  Correlation of Incidents using time difference Rajhesh 1 1,872 Jun-27-2019, 03:44 PM
Last Post: Larz60+
  Time Difference in Epoch Microseconds then convert to human readable firesh 4 11,690 Feb-27-2018, 09:08 AM
Last Post: firesh
  Calculating time difference between times and splitting the HH and MM Bass 7 10,729 Jul-03-2017, 01:26 PM
Last Post: Bass

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020