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: 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: References: From: Ian Kelly Date: Tue, 8 Jan 2013 14:33:50 -0700 Subject: Re: How to tell how many weeks apart two datetimes are? To: Python 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On Tue, Jan 8, 2013 at 2: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? Seems to be supported in Python 3.3, but not in 2.7.