I've written a small python script to determine the age of a record and if it is more than a week old. I do this by subtracting the record date from now()
. The record returns the date 2016-02-23 09:01:22
as datetime.
now = datetime.datetime.now()
age = now - recordDate
print age
this prints the result as 71 days, 23:56:07.156000
Is there a more "pythonic" way to get it to output just the days (and no hours etc.) than my hack solution of
print str(age).split(',',1)[0]
which prints the result as 71 days
?