Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #46974
| Path | csiph.com!usenet.pasdenom.info!gegeweb.org!de-l.enfer-du-nord.net!feeder2.enfer-du-nord.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <python.list@tim.thechases.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.019 |
| X-Spam-Evidence | '*H*': 0.96; '*S*': 0.00; '%s"': 0.09; 'subject:How': 0.10; 'cc:addr:python-list': 0.11; '-tkc': 0.16; 'bonus.': 0.16; 'from:addr:python.list': 0.16; 'from:addr:tim.thechases.com': 0.16; 'from:name:tim chase': 0.16; 'index': 0.16; 'wrote:': 0.18; 'numerical': 0.19; 'subject:week': 0.19; 'import': 0.22; 'cc:addr:python.org': 0.22; 'cc:2**0': 0.24; 'cc:no real name:2**0': 0.24; 'header:In-Reply-To:1': 0.27; 'front': 0.32; 'skip:d 20': 0.34; 'could': 0.34; 'charset:us-ascii': 0.36; 'subject:?': 0.36; 'starting': 0.37; 'list,': 0.38; 'skip:6 10': 0.63; 'to:addr:gmail.com': 0.65; 'date,': 0.68; 'day': 0.76; 'received:50.22': 0.84 |
| Date | Tue, 4 Jun 2013 16:50:03 -0500 |
| From | Tim Chase <python.list@tim.thechases.com> |
| To | PieGuy <r90230@gmail.com> |
| Subject | Re: How to increment date by week? |
| In-Reply-To | <b07dac48-1479-42cc-908c-21a3b2e14198@googlegroups.com> |
| References | <b07dac48-1479-42cc-908c-21a3b2e14198@googlegroups.com> |
| X-Mailer | Claws Mail 3.7.6 (GTK+ 2.20.1; x86_64-pc-linux-gnu) |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=US-ASCII |
| Content-Transfer-Encoding | 7bit |
| X-AntiAbuse | This header was added to track abuse, please include it with any abuse report |
| X-AntiAbuse | Primary Hostname - boston.accountservergroup.com |
| X-AntiAbuse | Original Domain - python.org |
| X-AntiAbuse | Originator/Caller UID/GID - [47 12] / [47 12] |
| X-AntiAbuse | Sender Address Domain - tim.thechases.com |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.2684.1370382496.3114.python-list@python.org> (permalink) |
| Lines | 21 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1370382496 news.xs4all.nl 16009 [2001:888:2000:d::a6]:59057 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:46974 |
Show key headers only | View raw
On 2013-06-04 14:31, PieGuy wrote:
> Starting on any day/date, I would like to create a one year
> list, by week (start date could be any day of week). Having a
> numerical week index in front of date, ie 1-52, would be a bonus.
> ie, 1. 6/4/2013 2. 6/11/2013 3. 6/18/2013....etc to # 52.
import datetime
start = datetime.date.today()
for i in range(53):
dt = start + datetime.timedelta(days=7*i)
result = "%i. %s" % (
i+1,
dt.strftime('%m/%d/%Y')
)
do_something_with(result)
-tkc
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to increment date by week? PieGuy <r90230@gmail.com> - 2013-06-04 14:31 -0700 Re: How to increment date by week? Joshua Landau <joshua.landau.ws@gmail.com> - 2013-06-04 22:44 +0100 Re: How to increment date by week? Tim Chase <python.list@tim.thechases.com> - 2013-06-04 16:50 -0500 Re: How to increment date by week? John Gordon <gordon@panix.com> - 2013-06-04 21:48 +0000 Re: How to increment date by week? Giorgos Tzampanakis <giorgos.tzampanakis@gmail.com> - 2013-06-04 21:47 +0000 RE: How to increment date by week? Carlos Nepomuceno <carlosnepomuceno@outlook.com> - 2013-06-05 01:52 +0300 Re: How to increment date by week? Skip Montanaro <skip@pobox.com> - 2013-06-04 20:17 -0500 Re: How to increment date by week? steve.ferg.bitbucket@gmail.com - 2013-06-04 20:43 -0700 Re: How to increment date by week? PieGuy <r90230@gmail.com> - 2013-06-05 09:39 -0700
csiph-web