Calculating future dates
Ben Finney
bignose+hates-spam at benfinney.id.au
Thu Feb 1 21:21:47 EST 2007
"Toine" <bapolis at gmail.com> writes:
> On Feb 1, 4:54 pm, "Dan Bishop" <danb... at yahoo.com> wrote:
> > str(datetime.date.today() + datetime.timedelta(31))
>
> Your example gave me a few errors but I was able to adapt it into
> this:
>
> str(date.today() + timedelta(31))
That only works if you're importing 'date' and 'timedelta' into the
current namespace. It's better to keep them in the 'datetime'
namespace, so it's clear what comes from where.
>>> import datetime
>>> str(datetime.date.today() + datetime.timedelta(31))
--
\ "How many people here have telekenetic powers? Raise my hand." |
`\ -- Emo Philips |
_o__) |
Ben Finney
More information about the Python-list
mailing list