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

Kun neurogasm at gmail.com
Mon Apr 17 19:25:41 EDT 2006


skip at pobox.com wrote:
>     Kun> i have the following python-cgi which extracts data from a mysql
>     Kun> table, how do i parse the date so that it doesn't display the time
>     Kun> '00:00:00.00'?
> 
> I have no idea which column in your table is a datetime object, but just
> convert it to a date.  For example:
> 
>     >>> import datetime
>     >>> dt = datetime.datetime.now()
>     >>> print dt
>     2006-04-17 18:19:38.698925
>     >>> print dt.date()
>     2006-04-17
> 
> Skip
assuming that my date column is 2, how would i parse out the date? the 
example you gave is of you parsing out the current time, but how do you 
parse out a pre-specified time that is extracted via sql? i don't think 
something like dt.date() works because it doesn't work with a string? 
correct me if i'm wrong.



More information about the Python-list mailing list