I need to get how many seconds have passed since an element created which is stored as a datetime element in datastore (Google App Engine). I am using a datetime variable. But I could not convert the time difference to seconds.
(Python 2.7)
Here is my aim:
def time_difference(datetime_time):
return int(datetime.now()-datetime_time) #result should be in seconds like 612
Thanks a lot!
Subtracting datetime returns a timedelta. In Python 2.7 timedelta has a total_seconds() method.