[Python-ideas] Add a "week" function or attribute to datetime.date

Robert Vanden Eynde robertve92 at gmail.com
Fri Mar 1 05:47:30 EST 2019


Currently one can do week = d.isocalendar()[1]

The iso definition of a week number has some nice properties.

robertvandeneynde.be

On Fri, 1 Mar 2019, 11:44 Antonio Galán, <angala.agl at gmail.com> wrote:

> The week number is usually refered to the week of the year, but the week
> of the month is also interesting, for example for some holiday which depend
> on the week number of the month, so in analogy with "weekday" we can use
> "yearweek" and "monthweek"
> El vie., 1 de marzo de 2019 9:33, Adrien Ricocotam <ricocotam at gmail.com>
> escribió:
>
>> I like the idea. But how to distinguish it from the number of week past
>> since the beginning of the month ?
>>
>> But that’s great.
>>
>> On Fri 1 Mar 2019 at 09:31, Antonio Galán <angala.agl at gmail.com> wrote:
>>
>>> Hi, datetime.date.today() (or other day)  has attributes .year and
>>> .month wich return the year and the month of that date, also it has a
>>> function weekday() wich return the number of the day in the week.
>>>
>>> I think it is a good idea add a function or attribute "week" wich return
>>> the number of the week on the year. It is useful to execute scripts once a
>>> week for example.
>>> _______________________________________________
>>> Python-ideas mailing list
>>> Python-ideas at python.org
>>> https://mail.python.org/mailman/listinfo/python-ideas
>>> Code of Conduct: http://python.org/psf/codeofconduct/
>>>
>> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190301/b3ddf568/attachment.html>


More information about the Python-ideas mailing list