Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Sum up Time difference
#11
(Apr-05-2023, 09:43 PM)tester_V Wrote: I do not see how I can get from this:
You can also keep track of a cumulated time difference,
cum_time_dif = datetime.timedelta() # initialize cumulated time difference to a null duration
...
t_end = datetime.strptime(end_t, "%m/%d/%Y %I:%M:%S %p")                    
t_start = datetime.strptime(start_t, "%m/%d/%Y %I:%M:%S %p")
time_dif = t_end - t_start
print(f" Time Difference = {time_dif}-{type(time_dif)}")
cum_time_dif += time_dif # increase cumulated time difference
...
print(f'Cumulated Time Difference = {cum_time_dif}')
lothar and tester_V like this post
Reply


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