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


Groups > comp.lang.python > #92415

Re: How to find number of whole weeks between dates?

Path csiph.com!usenet.pasdenom.info!news.redatomik.org!newsfeed.xs4all.nl!newsfeed3.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.020
X-Spam-Evidence '*H*': 0.96; '*S*': 0.00; 'subject:number': 0.07; 'subject:How': 0.09; 'wed,': 0.15; '2014': 0.16; '28th': 0.16; 'expecting': 0.16; 'sebastian': 0.16; 'subject:between': 0.16; 'subject:dates': 0.16; 'subject:weeks': 0.16; 'wrote:': 0.16; '>>>': 0.20; 'am,': 0.23; '2015': 0.23; 'import': 0.24; 'header :In-Reply-To:1': 0.24; 'message-id:@mail.gmail.com': 0.28; '12th': 0.29; 'skip:d 20': 0.32; 'weeks': 0.34; 'subject:?': 0.34; 'received:google.com': 0.34; 'to:addr:python-list': 0.35; 'subject:: ': 0.37; 'say': 0.38; 'to:addr:python.org': 0.39; 'total': 0.64; 'python-list': 0.66; 'cheung': 0.84; 'to:name:python': 0.84; 'subject:find': 0.91
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=3zDc9qHfqG05WVMIcnXcuygreOZSzq6//Kls40mdeIk=; b=vgzCnNwKfHF3IsDrp1JOkAQ6IkKVUVHtW9tSdHQeZIRJe/JL+plqgS0G4yGq01vbJz EN3HBx5RrFyLRSllyGMTih12AlxWd69QwAocjr0J9S/KXuTwFcHC1wiRBc4KQama6oQ3 WPxjS9rhBw+TmOPOj5iPnAXkSNJ9b/+JNFrj9i97id08YuDPHXcX155PjCF2hXu/qlhg 9Tu73NKNoG9Ny+2Dp2CPIvad9wMtPgSW8CXBn8r9TIFzilD7nywXDvYeR0NIX6LAqq2H L/J4WsTMtefAfUeK2Wi38Yx2t9IleLQC2KqvsBE8HwjfN0TvbJ/SyGGnrwFrqSPSsiO7 vexw==
X-Received by 10.13.229.198 with SMTP id o189mr5582943ywe.108.1433958160315; Wed, 10 Jun 2015 10:42:40 -0700 (PDT)
MIME-Version 1.0
In-Reply-To <a2056385-f99b-4691-9a33-5def63216e9c@googlegroups.com>
References <a2056385-f99b-4691-9a33-5def63216e9c@googlegroups.com>
From Ian Kelly <ian.g.kelly@gmail.com>
Date Wed, 10 Jun 2015 11:42:00 -0600
Subject Re: How to find number of whole weeks between dates?
To Python <python-list@python.org>
Content-Type text/plain; charset=UTF-8
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://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 <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.351.1433958601.13271.python-list@python.org> (permalink)
Lines 13
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1433958601 news.xs4all.nl 2854 [2001:888:2000:d::a6]:57052
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:92415

Show key headers only | View raw


On Wed, Jun 10, 2015 at 11:05 AM, Sebastian M Cheung via Python-list
<python-list@python.org> wrote:
> Say in 2014 April to May whole weeks would be 7th, 14th 28th April and  May would be 5th, 12th and 19th. So expecting 7 whole weeks in total

>>> from datetime import date
>>> d1 = date(2014, 4, 7)
>>> d2 = date(2014, 5, 19)
>>> d2 - d1
datetime.timedelta(42)
>>> (d2 - d1).days
42
>>> (d2 - d1).days // 7
6

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


Thread

How to find number of whole weeks between dates? Sebastian M Cheung <minscheung@googlemail.com> - 2015-06-10 10:05 -0700
  Re: How to find number of whole weeks between dates? Marko Rauhamaa <marko@pacujo.net> - 2015-06-10 20:38 +0300
    Re: How to find number of whole weeks between dates? Marko Rauhamaa <marko@pacujo.net> - 2015-06-10 20:43 +0300
    Re: How to find number of whole weeks between dates? Laura Creighton <lac@openend.se> - 2015-06-10 19:50 +0200
    Re: How to find number of whole weeks between dates? Joel Goldstick <joel.goldstick@gmail.com> - 2015-06-10 14:07 -0400
    Re: How to find number of whole weeks between dates? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-10 20:48 +0100
  Re: How to find number of whole weeks between dates? Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-10 11:42 -0600
  Re: How to find number of whole weeks between dates? Sebastian M Cheung <minscheung@googlemail.com> - 2015-06-10 13:11 -0700
    Re: How to find number of whole weeks between dates? Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-06-10 21:26 +0100
    Re: How to find number of whole weeks between dates? Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-10 14:33 -0600
    Re: How to find number of whole weeks between dates? Michael Torrie <torriem@gmail.com> - 2015-06-10 21:19 -0600
    Re: How to find number of whole weeks between dates? Chris Angelico <rosuav@gmail.com> - 2015-06-11 13:36 +1000
    Re: How to find number of whole weeks between dates? Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-10 21:45 -0600
  Re: How to find number of whole weeks between dates? Sebastian M Cheung <minscheung@googlemail.com> - 2015-06-10 19:01 -0700
    Re: How to find number of whole weeks between dates? Ian Kelly <ian.g.kelly@gmail.com> - 2015-06-10 21:35 -0600

csiph-web