Difference between two dates in seconds

C

Claes at work

Hi,

I am learning Python and want to perform what I think is a very simple
task: calculating the difference between two dates in seconds. Reading
through the documentation I am puzzled: I can't find a way to do this
without doing manually what I think belongs to a standard library
method.

Please tell me there is a simpler way than subtracting two datetimes
to get a timedelta and then compute

days * number of seconds per day + seconds

from it myself??

Put in other words - I find it puzzling that timedelta exposes its
internal representation (the instance attributes days and seconds) but
not ways to get the difference in arbitrary units. What am I missing?

Thanks, Claes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top