How to get the difference in seconds between two datetime.date objects in Python

Getting the difference in seconds between two datetime.date objects results in a datetime.timedelta object that represents the difference between them. For example, the difference between 2015-07-14 and 2015-05-18 results in 4924800.0.

Solution for How to get the difference in seconds between two datetime.date objects in Python : You can use datetime.timedelta.total_seconds() to get the difference in seconds between two datetime.date objects Subtract one datetime.date from another to return a datetime.timedelta containing the time difference between two dates. Call datetime.timedelta.seconds() to return the difference in seconds.


how-to-get-the-difference-in-seconds-between-two-datetime-date-objects-in-python