import datetime
date1 = raw_input("Enter date1 as year-month-day: ")
year1, month1, day1 = date1.split('-')
date1 = datetime.date(int(year1), int(month1), int(day1))
date2 = raw_input("Enter date2 as year-month-day: ")
year2, month2, day2 = date2.split('-')
date2 = datetime.date(int(year2), int(month2), int(day2))
print "date2 - date1 is", date2 - date1
Here's one run:
Enter date1 as year-month-day: 2003-4-15
Enter date2 as year-month-day: 2008-4-15
date2 - date1 is 1827 days, 0:00:00
How can I get rid of that "0:00:00"?
And there must be a better way. What is it?
Thanks,
Dick Moores
UliPad <<The Python Editor>>: http://code.google.com/p/ulipad/
_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor