[newbie] Manipulating Dates
Tom B.
sbabbitt at commspeed.net
Fri Sep 19 00:39:54 EDT 2003
"Elliot Clifton" <ec at clif2.com> wrote in message
news:3cad211d.0309170822.b31822 at posting.google.com...
> X-No-archive: yes
>
> Hi,
>
> How do I do the following with the Date object:
>
> newDate = oldDate + 3 months
>
> What would that be in Python code?
>
> Thanks,
>
> Elliot
In python 23 the datetime module if for date calculations
import datetime
some_date = datetime.date(2003,9,18)
add_date = datetime.timedelta(weeks=12)
new_date = some_date + add_date
>>> new_date
datetime.date(2003, 12, 11)
Tom
More information about the Python-list
mailing list