I have a script that get the date from datetime, and the date from whois service:
import time
from datetime import datetime
import whois
#date
url='testurl.com'
now = datetime.now()
date1 = datetime.strftime(nowstr,'%Y-%m')
#whois
domain = whois.whois(url)
datestr = domain.creation_date
date2 = datetime.strftime(datestr, '%Y-%m')
When i calculate the difference:
diff = datetime.strptime(date1,'%Y-%m') - datetime.strptime(date2,'%Y-%m')
print diff
it gives me output like:
5451 days, 0:00:00
How can i get the Output in the format of Years and months(in my case, 14y 11m)?