I have a date variable: 2011-01-15 and I would like to get a boolean back if said date is within 3 days from TODAY. Im not quite sure how to construct this in P
Subtracting two date objects gives you a timedelta object, which you can compare to other timedelta objects.
For example:
>>> from datetime import date, timedelta
>>> date(2011, 1, 15) - date.today()
datetime.timedelta(1)
>>> date(2011, 1, 15) - date.today() < timedelta(days = 3)
True
>>> date(2011, 1, 18) - date.today() < timedelta(days = 3)
False
As to "where to look": the official documentation is excellent.