Answers for "python minutes between two datetimes"

1

Date difference in minutes in Python

minutes_diff = (datetime_end - datetime_start).total_seconds() / 60.0
Posted by: Guest on January-08-2021
1

get time between things python

>>> import datetime
>>> time1 = datetime.datetime.now()
>>> time2 = datetime.datetime.now() # waited a few minutes before pressing enter
>>> elapsedTime = time2 - time1
>>> elapsedTime
datetime.timedelta(0, 125, 749430)
>>> divmod(elapsedTime.total_seconds(), 60)
(2.0, 5.749430000000004) # divmod returns quotient and remainder
# 2 minutes, 5.74943 seconds
Posted by: Guest on December-01-2020

Code answers related to "python minutes between two datetimes"

Python Answers by Framework

Browse Popular Code Answers by Language