Tim Chase wrote: > I've been trying to come up with a good algorithm for determining > the starting and ending dates given the week number (as defined > by the strftime("%W") function).
I think you missed %U format, since later you write: > My preference would be for a Sunday->Saturday range rather than a > Monday->Sunday range. Thus, > Any thoughts/improvements/suggestions would be most welcome. 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 -- http://mail.python.org/mailman/listinfo/python-list