python datetime
Peter Otten
__peter__ at web.de
Tue Sep 14 03:51:37 EDT 2010
Von wrote:
> How to determine a date is just the 7th day after today
> ie: today is 14 Sep the 7th day is 14+7 = 21,but assume today is 28 Sep
> the 7th day is 5 Oct,is there simple way to do this work?
> I wish I explained clear
The datetime module takes care of this
>>> import datetime as dt
>>> dt.date(2010, 9, 28) + dt.timedelta(days=7)
datetime.date(2010, 10, 5)
See
http://docs.python.org/library/datetime.html
Why didn't you find that yourself? It's the first match if you google for
python datetime.
Peter
More information about the Python-list
mailing list