Geek Logbook

Tech sea log book

Python calculate seconds and total_seconds

If you want to calculate the total seconds between two dates. You could be tempted to do a time delta and see the seconds. But this approach will give you an unexpected result. You have to use time_second.

Return the total number of seconds contained in the duration. 

https://docs.python.org/3/library/datetime.html#datetime.timedelta.total_seconds

Source:

Tags:

Leave a Reply

Your email address will not be published. Required fields are marked *.