current week / weeks in year - best practice

Tim Roberts timr at
Sun Aug 3 01:09:55 CEST 2008

Aljosa Mohorovic <aljosa.mohorovic at> wrote:
>what if i know current context week = 20 (example), what would be the
>best way to get datetime objects for first and last day of current
>context week?
>by "current context week" i don't mean current week for current year
>but current week when program is iterating all weeks in year.

One of the problems is that "current week of the year" is not a
well-defined term.  Some companies define the first week as the week that
contains January 1.  Some companies define the first week as the first full
week, so that a partial Jan 1 week is actually part of the previous year.
And you get the whole "does the week start on Sunday or Monday" debate as

You need to make sure that the datetime functions match your business
Tim Roberts, timr at
Providenza & Boekelheide, Inc.

More information about the Python-list mailing list