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


Groups > comp.lang.python > #89367

Re: date from day (count) of year

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed4a.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.159
X-Spam-Level *
X-Spam-Evidence '*H*': 0.69; '*S*': 0.00; '24,': 0.16; '7:45': 0.16; 'wrote:': 0.18; '>>>': 0.22; '&gt;&gt;&gt;': 0.24; '&gt;': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'subject:) ': 0.29; 'message-id:@mail.gmail.com': 0.30; 'subject:from': 0.34; 'could': 0.34; 'subject: (': 0.35; 'received:google.com': 0.35; 'skip:& 10': 0.38; 'to:addr:python-list': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'how': 0.40; 'year.': 0.61; 'subject:day': 0.69; 'day': 0.76; '2015': 0.84
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=+Ryn5rqH7g5WJ3swxGTL3Dqy2CBP3kgAIf0IDwvLzSM=; b=1AJBh/7Sr+J74gDXvd/QXZgRFT0BgLZymFC0ES7DXrep7d95LIrBmwlxuTbXjbuCoe yi1mG6DFVrxOPoVGsqZN4kFqeTbUHefcKsrPfNwIMrevqy0bE6voyDFijs5ZFAgPyjv4 XUSvdnSFeJ7sJJXljl0v4UbYmCw/COos/fDzMheL+9APT5yabzWcLkt4QrSWzIkKx/Te VrCbHumJHu8lBcXNT46G306wkV8qEoDXVuJPb4wXsBBkCNJCush93uCT16Yg+pBx9N+s /Ec4snv3FoglB5cHa0QY6yxaWxShmwiXzvUSD0Qoifs5nS3OSp2HQ3pdZLvX2WxrPaMq xYyQ==
MIME-Version 1.0
X-Received by 10.107.12.158 with SMTP id 30mr10809734iom.61.1429884114981; Fri, 24 Apr 2015 07:01:54 -0700 (PDT)
In-Reply-To <CALyJZZXadojH07+icqqqA0hSEb8jM0Op4T=5kfUdkGdUpwn+YQ@mail.gmail.com>
References <CALyJZZXadojH07+icqqqA0hSEb8jM0Op4T=5kfUdkGdUpwn+YQ@mail.gmail.com>
Date Fri, 24 Apr 2015 08:01:54 -0600
Subject Re: date from day (count) of year
From Ian Kelly <ian.g.kelly@gmail.com>
To Python <python-list@python.org>
Content-Type multipart/alternative; boundary=001a113dc818beab9e051478d6cf
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.4.1429884123.3680.python-list@python.org> (permalink)
Lines 36
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1429884123 news.xs4all.nl 2885 [2001:888:2000:d::a6]:40241
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:89367

Show key headers only | View raw


[Multipart message — attachments visible in raw view] - view raw

On Apr 24, 2015 7:45 AM, "Vincent Davis" <vincent@vincentdavis.net> wrote:
>
> How does one get the date given the day of a year.
>
> >>> dt.datetime.now().timetuple().tm_yday
>
> 114
>
> How would I get the Date of the 114 day of 2014?

You could use a timedelta:

>>> dt.date(2014, 1, 1) + dt.timedelta(114 - 1)
datetime.date(2014, 4, 24)

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


Thread

Re: date from day (count) of year Ian Kelly <ian.g.kelly@gmail.com> - 2015-04-24 08:01 -0600

csiph-web