This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author bnahas
Recipients
Date 2007-01-25.19:39:57
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
No worries.

Here's what I'm doing as a work-around.  I needed to convert the results of a mysql YEARWEEK field to the sunday at the start of that week:

import datetime
def mysqlWeekToSundayDate(yearweek):
    year = int(yearweek[0:4])
    week = int(yearweek[4:6])
    day = datetime.date(year, 1, 1)
    dayDelta = datetime.timedelta(1)
    weekDelta = datetime.timedelta(7)
    while day.strftime("%w") != "0":
        day = day + dayDelta
    
    day = day + ((week - 1) * weekDelta)
        
    return day

I'm relatively new to Python so it is probably not the most efficient method but it does the job.
History
Date User Action Args
2007-08-23 14:51:33adminlinkissue1643943 messages
2007-08-23 14:51:33admincreate