Python Forum
Calculating time difference between times and splitting the HH and MM
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Calculating time difference between times and splitting the HH and MM
#6
pendulum is what i think is best date/times library for Python.
All python standard library datetime work in pendulum.
So as a example can use sydney_open made in datetime and subtract if from pendulum.now().
>>> import pendulum

>>> now = pendulum.now()
>>> now
<Pendulum [2017-07-03T00:56:43.582239+02:00]>
>>> countdown = sydney_open - now

>>> print(f"Sydney opens in {countdown.hours} hours and {countdown.minutes} minutes")
Sydney opens in 21 hours and 3 minutes
Reply


Messages In This Thread
RE: Calculating time difference between times and splitting the HH and MM - by snippsat - Jul-02-2017, 11:04 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  time difference bettwenn logs enkliy 14 1,153 Nov-21-2023, 04:51 PM
Last Post: rob101
  Hard time trying to figure out the difference between two strings carecavoador 2 710 Aug-16-2023, 04:53 PM
Last Post: carecavoador
  Sum up Time difference tester_V 10 2,691 Apr-06-2023, 06:54 AM
Last Post: Gribouillis
  splitting total time between days tester_V 7 3,152 Nov-14-2020, 04:40 AM
Last Post: tester_V
  How to get indices of minimum time difference Mekala 1 2,204 Nov-10-2020, 11:09 PM
Last Post: deanhystad
  Split gps files based on time (text splitting) dervast 0 1,915 Nov-09-2020, 09:19 AM
Last Post: dervast
  How to calculate time difference between each row of dataframe in seconds Mekala 1 2,626 Jul-16-2020, 12:57 PM
Last Post: Larz60+
  Correlation of Incidents using time difference Rajhesh 1 1,870 Jun-27-2019, 03:44 PM
Last Post: Larz60+
  Time Difference in Epoch Microseconds then convert to human readable firesh 4 11,689 Feb-27-2018, 09:08 AM
Last Post: firesh

Forum Jump:

User Panel Messages

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