scanning through page and replacing all instances of 00:00:00.00

skip at pobox.com skip at pobox.com
Mon Apr 17 21:07:48 EDT 2006


    Kun> assuming that my date column is 2, how would i parse out the date?

No parsing required.  Just get its date:

    d = record[2].date()

The str() of a datetime.date object is a string in YYYY-MM-DD form.

    Kun> the example you gave is of you parsing out the current time, but
    Kun> how do you parse out a pre-specified time that is extracted via
    Kun> sql? i don't think something like dt.date() works because it
    Kun> doesn't work with a string?  correct me if i'm wrong.

I think MySQLdb automatically returns datetime objects when the column data
type is date.

Skip



More information about the Python-list mailing list