Dick Moores wrote: > I'm really struggling with the datetime module. Trying for a script that > will calculate the number of days between any two dates
How about this: from datetime import datetime date1 = raw_input("Enter date1 as year-month-day: ") date1 = datetime.strptime(date1, '%Y-%m-%d') date2 = raw_input("Enter date2 as year-month-day: ") date2 = datetime.strptime(date2, '%Y-%m-%d') print "date2 - date1 is", (date2 - date1).days, 'days' Kent _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor