Answers for "difference of dates in hours datetime python"

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

time difference between two datetime.time

# Create datetime objects for each time (a and b)
dateTimeA = datetime.datetime.combine(datetime.date.today(), a)
dateTimeB = datetime.datetime.combine(datetime.date.today(), b)
# Get the difference between datetimes (as timedelta)
dateTimeDifference = dateTimeA - dateTimeB
# Divide difference in seconds by number of seconds in hour (3600)  
dateTimeDifferenceInHours = dateTimeDifference.total_seconds() / 3600
Posted by: Guest on January-11-2021

Code answers related to "difference of dates in hours datetime python"

Python Answers by Framework

Browse Popular Code Answers by Language