It's taken me a couple of hours to give up on strptime with %Z for recognizing
time zones... but that still leaves me in the wrong zone:

def paypal_to_mysql_date(ppDate):
    # a typical paypal date is 10:29:52 Feb 29, 2008 PST
    date_parts = ppDate.split()
    withouttz = " ".join(date_parts[:-1])

    # eventually we need to apply the timezone
    timezone = date_parts[-1]

    dt = datetime.strptime(withouttz, "%H:%M:%S %b %d, %Y")
    return dt.strftime("%Y-%m-%d %H:%M")


How can I use the "PST" (or any other time zone name) to adjust dt by the
correct number of hours to get it into UTC before storing in MySQL?

Thanks!


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to