difference datetime.datetime and datetime.date code example
Example 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
Example 2: date vs datetime
DATE : YYYY-MM-DD format
DATETIME : YYYY-MM-DD HH:MM:SS format
TIMESTAMP : X s from 1970 format
TIME : HH:MM:SS format