Fwd: datetime formatting output

I

Igor Korot

---------- Forwarded message ----------
From: Igor Korot <[email protected]>
Date: Sat, Feb 8, 2014 at 1:06 AM
Subject: Re: datetime formatting output
To: Chris Angelico <[email protected]>


Chris,


It's not a milliseconds field, that's why :) The real question is: Why
is the datetime you're getting from MySQL putting milliseconds into
the microseconds field? Possibly if you show your code for generating
those datetime objects, that would help.

Nothing fancy, really. ;-)

import MySQLdb as mdb
self.conn = mdb.connect()
self.cur = self.conn.cursor()
self.cur.execute("SELECT * FROM mytable")
db_results = self.cur.fetchall()
for row in db_results:
my_dict = {}
#Fill in my_dict
if row[3] is not None:
my_dict["Install"] = row[3]

That's all.

P.S.: Maybe its a problem with the datetime module which formats the
datetime incorrectly?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

print header for output 0

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top