Noob | datetime question

D

Demel, Jeff

I'm having trouble finding exactly what I need by googling, so thought
I'd try to get a quick answer from the group. This seems like something
that should be dead simple.

I need to generate a string value of a date in the format YYYYMMDD that
is 97 days in the future. The datetime module is brand new to me, and
I'm not sure how to do this. Can someone help me out here?

TIA

-Jeff
This email is intended only for the individual or entity to which it is addressed. This email may contain information that is privileged, confidential or otherwise protected from disclosure. Dissemination, distribution or copying of this e-mail or any attachments by anyone other than the intended recipient, or an employee or agent responsible for delivering the message to the intended recipient, is prohibited. If you are not the intended recipient of this message or the employee or agent responsible for delivery of this email to the intended recipient, please notify the sender by replying to this message and then delete it from your system. Any use, dissemination, distribution, or reproduction of this message by unintended recipients is strictly prohibited and may be unlawful.
 
W

wittempj

I'm having trouble finding exactly what I need by googling, so thought
I'd try to get a quick answer from the group. This seems like something
that should be dead simple.

I need to generate a string value of a date in the format YYYYMMDD that
is 97 days in the future. The datetime module is brand new to me, and
I'm not sure how to do this. Can someone help me out here?
With the datetime module you can do something like:

py> import datetime
py> d = datetime.date.today()
py> print d
2006-11-14
py> d97 = d + datetime.timedelta(days=97)
py> print d97
2007-02-19
py> fmt_d97 = d97.isoformat().replace('-', '')
py> print fmt_d97
20070219
 

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
473,990
Messages
2,570,211
Members
46,796
Latest member
SteveBreed

Latest Threads

Top