I am using Python whois API called 'pythonwhois' and trying to extract the 'creation_date' for a list of domain names. The code I am using is:
f = open (file,'r')
with open (output,'wt') as m:
for line in f:
line = line.strip('\n')
domain = line.split(';')
try:
w = pythonwhois.get_whois(domain)
c_date = (w['creation_date'])
print (domain,c_date)
except:
pass
The result is a list of datetime.datetime objects as below:
domain,creation_date
('hostzi.com', [datetime.datetime(2009, 5, 12, 13, 4, 12)])
('daduru.com', [datetime.datetime(2007, 4, 16, 10, 59)])
('callforest.com', [datetime.datetime(2006, 4, 23, 14, 29, 1)])
and I want to convert the 'creation_date' column to a python the string representation of the date in the format of Y/m/d. Can anybody help?