Which date will it be 'over x days'?
sjmachin at lexicon.net
Tue Sep 19 00:15:14 CEST 2006
> I must be overlooking something since I can't find a simple way to
> calculate which date it will be over, say, 9 days. I checked the
> datetime, time and calendar modules, but none of them seem to have a
> function to calculate the time offset.
I suppose that it depends on your thresholds for "simple" and "seem"
but datetime.timedelta() does it for me:
| >>> import datetime
| >>> datetime.date.today()
| datetime.date(2006, 9, 19)
| >>> datetime.date.today() + datetime.timedelta(days=9)
| datetime.date(2006, 9, 28)
More information about the Python-list