Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #36453

Re: How to tell how many weeks apart two datetimes are?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!us.feeder.erje.net!news2.arglkargh.de!nuzba.szn.dk!pnx.dk!news.stack.nl!newsfeed.xs4all.nl!newsfeed4.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail
Return-Path <ian.g.kelly@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.035
X-Spam-Evidence '*H*': 0.93; '*S*': 0.00; 'allowed.': 0.07; 'subject:two': 0.07; 'subject:How': 0.09; 'python': 0.09; 'be:': 0.09; '3.3,': 0.16; 'roy': 0.16; 'subject:weeks': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'seems': 0.23; 'header:In-Reply-To:1': 0.25; 'appear': 0.26; 'supported': 0.26; 'message-id:@mail.gmail.com': 0.27; "doesn't": 0.28; 'division': 0.29; 'to:addr:python-list': 0.33; 'weeks': 0.33; 'received:google.com': 0.34; 'pm,': 0.35; 'received:209.85.220': 0.35; 'subject:?': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'two': 0.37; 'why': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'some': 0.38; 'to:addr:python.org': 0.39; 'header:Received:5': 0.40; 'smith': 0.71; '2.7.': 0.84; '2013': 0.84; 'are?': 0.84; 'subject:tell': 0.84; 'to:name:python': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :content-type; bh=G5b9sdx1akSlpBFtOjvqeZc71stGLDtl6f3jeKh/Zcw=; b=TCjXBBiu+0XV1ynSK0U9G4XuuXSUtZYQ+lXKdObxY/pIXJtgUYm5p2nBrrzFDRLC5U DIf/3r3gYcn4AElu7n9qu2oGOuXUKNVYVIX97nV5HDwVmQM0Zq70fksqlYjozKPk9cwN cw32MQ9tKl4IbBOfCB2I1d70JMF8gc2nq14YWZoThyL9NjCYSZRqMssMR8/8Gs3ncDyp kYb9hmKgJmA7berPejgNd56kcU9SQYqLmzi6INLXoPtOJJjLzCX1CTzmMwjcCNx8QpKq vCIqlGtEOvkBa4kIZlgerzNz/nydWZLfWSM1TjqnFlwqY3NmEpvQKsT7TSTvCzOZMBp7 yong==
MIME-Version 1.0
In-Reply-To <kci2m1$fp4$1@panix2.panix.com>
References <kci2m1$fp4$1@panix2.panix.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Tue, 8 Jan 2013 14:33:50 -0700
Subject Re: How to tell how many weeks apart two datetimes are?
To Python <python-list@python.org>
Content-Type text/plain; charset=ISO-8859-1
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.292.1357680863.2939.python-list@python.org> (permalink)
Lines 10
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1357680863 news.xs4all.nl 6917 [2001:888:2000:d::a6]:49621
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:36453

Show key headers only | View raw


On Tue, Jan 8, 2013 at 2:22 PM, Roy Smith <roy@panix.com> 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?

Seems to be supported in Python 3.3, but not in 2.7.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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