Subtracting dates to get hours and minutes

Marc Lucke marc at marcsnet.com
Mon Dec 12 01:40:21 EST 2022


my approach would be to convert your two date/times to seconds from 
epoch - e.g. 
https://www.geeksforgeeks.org/convert-python-datetime-to-epoch/ - then 
subtract the number, divide the resultant by 3600 (hours) & get the 
modulus for minutes.  There's probably a standard function - it should 
be /very/ easy to do.

- Marc

On 12/12/2022 5:01 pm, Steve GS wrote:
> How do I subtract two time/dates and calculate the hours and minutes
> between?
> Steve
>


More information about the Python-list mailing list