Getting start/end dates given week-number
Tim Chase
python.list at tim.thechases.com
Fri Jun 9 13:30:38 EDT 2006
> I think you missed %U format, since later you write:
correct. I remember seeing something (a long while back) that
had a Sunday-first format, but I must have missed it in my
reading of "man strftime".
> If you want to match %U:
>
> def weekBoundaries(year, week):
> startOfYear = date(year, 1, 1)
> week0 = startOfYear - timedelta(days=startOfYear.isoweekday())
> sun = week0 + timedelta(weeks=week)
> sat = sun + timedelta(days=6)
> return sun, sat
Works wonderfully...Thanks!
-tkc
More information about the Python-list
mailing list