[newbie] Manipulating Dates

E

Elliot Clifton

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
 
T

Tom B.

Elliot Clifton said:
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

datetime.date(2003, 12, 11)

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,164
Messages
2,570,898
Members
47,439
Latest member
shasuze

Latest Threads

Top