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


Groups > comp.lang.python > #89367

Re: date from day (count) of year

References <CALyJZZXadojH07+icqqqA0hSEb8jM0Op4T=5kfUdkGdUpwn+YQ@mail.gmail.com>
Date 2015-04-24 08:01 -0600
Subject Re: date from day (count) of year
From Ian Kelly <ian.g.kelly@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.4.1429884123.3680.python-list@python.org> (permalink)

Show all headers | 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