[DB-SIG] Python MySQL Date

Denis S. Otkidach ods at strana.ru
Tue Mar 30 06:51:30 EST 2004


On Tue, 30 Mar 2004, samira M'Bata wrote:

sM> I have a MySql Database with  a table: In this table one of
sM> the colums has
sM> the type Date. I use Python to access to my Database: My pb:
sM> when  I make a
sM> cursor.fetchall(), it returns me the date as following
sM> <DateTime object for
sM> '2004-11-24 00:00:00.00' at 404afd08> and when I make a
sM> print:  2004-11-24
sM> 00:00:00.00
sM> I want something like 2004-11-24

your_obj.strftime('%Y-%m-%d')

sM> I tried a split of the element of the tuple but he gives me
sM> an attribute
sM> error back. I also tried  severlals functions of the time
sM> module and that
sM> wasnt successful. WIch type is it? What should  I try?

It's a DateTime object from eGenix-mx-base.

-- 
Denis S. Otkidach
http://www.python.ru/      [ru]




More information about the DB-SIG mailing list