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


Groups > comp.lang.python > #89367 > unrolled thread

Re: date from day (count) of year

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2015-04-24 08:01 -0600
Last post2015-04-24 08:01 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

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

#89367 — Re: date from day (count) of year

FromIan Kelly <ian.g.kelly@gmail.com>
Date2015-04-24 08:01 -0600
SubjectRe: date from day (count) of year
Message-ID<mailman.4.1429884123.3680.python-list@python.org>

[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)

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web