Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36452
| Path | csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!us.feeder.erje.net!feeder.erje.net!eu.feeder.erje.net!newsfeed.straub-nv.de!nuzba.szn.dk!pnx.dk!news.stack.nl!newsfeed.xs4all.nl!newsfeed3.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <marduk@python.net> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.001 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'allowed.': 0.07; 'subject:two': 0.07; 'subject:How': 0.09; 'python': 0.09; 'be:': 0.09; 'received:internal': 0.09; 'message- id:@webmail.messagingengine.com': 0.16; 'received:10.202': 0.16; 'received:10.202.2': 0.16; 'received:10.202.2.44': 0.16; 'received:66.111': 0.16; 'received:66.111.4': 0.16; 'received:compute4.internal': 0.16; 'received:mail.srv.osa': 0.16; 'received:messagingengine.com': 0.16; 'received:nyi.mail.srv.osa': 0.16; 'received:osa': 0.16; 'received:srv.osa': 0.16; 'roy': 0.16; 'subject:weeks': 0.16; 'wrote:': 0.17; 'jan': 0.18; '>>>': 0.18; 'header:In-Reply-To:1': 0.25; 'appear': 0.26; "doesn't": 0.28; 'division': 0.29; 'url:mailman': 0.29; 'url:python': 0.32; 'url:listinfo': 0.32; 'to:addr:python-list': 0.33; 'weeks': 0.33; 'skip:d 20': 0.34; 'pm,': 0.35; 'subject:?': 0.35; 'there': 0.35; 'but': 0.36; 'url:org': 0.36; 'two': 0.37; 'why': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'received:10': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'url:mail': 0.40; 'header :Message-Id:1': 0.62; 'smith': 0.71; 'are?': 0.84; 'subject:tell': 0.84 |
| DKIM-Signature | v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=message-id:from:to:mime-version :content-transfer-encoding:content-type:in-reply-to:references :subject:date; s=smtpout; bh=iF3BeQ/7cyuEzg+TXMQua466zUI=; b=jf6 uhzlvuXSjQrTuNjRvgcg+mNNmDJh3d7D+vOORmtv8nY8F0w2F58+vHNLPcYrih6D ZvZM93L3WT9I5s7F/2yjZbbSRG3+ZXAxNqM1fHtj45bmyl+/d2GzYYw7dfdNoCbI dSuEjJAuOZfMF1vQJCYgo2dYgbBgQbDLncFPQfkI= |
| X-Sasl-Enc | HnPtpcQtsCecMwKhFoSjtqN2G7zf/yZMs4kOkgX2Ufoi 1357680702 |
| From | marduk <marduk@python.net> |
| To | python-list@python.org |
| MIME-Version | 1.0 |
| Content-Transfer-Encoding | 7bit |
| Content-Type | text/plain |
| X-Mailer | MessagingEngine.com Webmail Interface - ajax-33d24f93 |
| In-Reply-To | <kci2m1$fp4$1@panix2.panix.com> |
| References | <kci2m1$fp4$1@panix2.panix.com> |
| Subject | Re: How to tell how many weeks apart two datetimes are? |
| Date | Tue, 08 Jan 2013 16:31:42 -0500 |
| 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.291.1357680711.2939.python-list@python.org> (permalink) |
| Lines | 22 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1357680711 news.xs4all.nl 6990 [2001:888:2000:d::a6]:46754 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:36452 |
Show key headers only | View raw
On Tue, Jan 8, 2013, at 04:22 PM, Roy Smith wrote: > How do you tell how many weeks apart two datetimes (t1 and t2) are? > The "obvious" solution would be: > > weeks = (t2 - t1) / timedelta(days=7) > > but that doesn't appear to be allowed. Is there some fundamental > reason why timedelta division not supported? > -- > http://mail.python.org/mailman/listinfo/python-list It works for python 3(.2): >>> x = datetime.timedelta(days=666) >>> week = datetime.timedelta(days=7) >>> x / week 95.14285714285714 >>> halfday = datetime.timedelta(hours=12) >>> x / halfday 1332.0
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to tell how many weeks apart two datetimes are? roy@panix.com (Roy Smith) - 2013-01-08 16:22 -0500 Re: How to tell how many weeks apart two datetimes are? marduk <marduk@python.net> - 2013-01-08 16:31 -0500 Re: How to tell how many weeks apart two datetimes are? Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-08 14:33 -0700 Re: How to tell how many weeks apart two datetimes are? Ian Kelly <ian.g.kelly@gmail.com> - 2013-01-08 14:36 -0700 Re: How to tell how many weeks apart two datetimes are? MRAB <python@mrabarnett.plus.com> - 2013-01-08 22:50 +0000 Re: How to tell how many weeks apart two datetimes are? Oscar Benjamin <oscar.j.benjamin@gmail.com> - 2013-01-08 22:54 +0000
csiph-web