55,859 views
41 votes
41 votes
How to get seconds from datetime.datetime.now in python

User Barry Pitman
by
2.9k points

1 Answer

24 votes
24 votes

Answer:

Python provides an operation on datetime to compute the difference between two dates. It finds the difference between the initial datetime object and the datetime object created from the time string. The value returned is a timedelta object from which we can use the function total_seconds() to get the value in seconds.

Step-by-step explanation:

User Mark Vincze
by
2.6k points