[Tutor] MySQLdb table is DATE, but SELECT returns with TIMESTAMP.

Decibels decibelshelp@charter.net
Tue Jun 17 20:52:32 2003


Hi,
	Not quite sure why it is doing this. I will try to make this brief as possible.

1) Created table in database with various columns. One of which is a date type.
    But I specifically said 'date'

cursor.execute("""
	CREATE TABLE portfolio
,....
datebought date default NULL,
,....
		""")

2) I have sucessfully entered data into the table with the program I wrote.
The DATE is in the correct format and shows correctly with no errors.

3) I am trying to write the part to delete a row if it matches 3 items. One of
which is the DATE.  But I need to search the table first to see if any items
match. Don't want to delete the wrong one.

When I put in some print statements to see why it wasn't working the date 
part was showing me this:

2003-11-11 00:00:00.00

I was reading the MySQL manual to see why it was doing that. One of the things it
says is:

      "If you assign a DATETIME or TIMESTAMP value to a DATE object, the time part of
       the resulting value is deleted, because the DATE type stores no time information."

also:

     "The DATE type is used when you need only a date value, without a time part. MySQL
     retrieves and displays DATE values in 'YYYY-MM-DD' format. The supported range 
     is '1000-01-01' to '9999-12-31'."

Is this one of the things like the floating point? Where it really stores it with the timestamp, like
floating point really stores it more than 2 decimel places.  If so it makes it hard to match when I
don't need a time stamp.

I tried +'00:00:00:00' but ran into the: TypeError: unsupported operand types for +: 'DateTime' and 'str'

I would rather do this without that anyway.

Any ideas??

Thanks, Dave