Re: datetime formatting output

2014-02-08 Thread Chris Angelico
On Sat, Feb 8, 2014 at 7:40 PM, Igor Korot ikoro...@gmail.com wrote:
 I am reading data from the DB (mySQL) where the datetime field is stored as:

 2012-12-12 23:59:59.099

 When I retrieve this date I am successfully see under debugger the dateteime
 object with (2012, 12, 12, 23, 59, 59, 099)

 However as you can see from my previous post this date shows up incorrectly
 as:

 2012-12-12 23:59:59.99

 Notice 3 extra 0's in the milliseconds field.

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.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: datetime formatting output

2014-02-08 Thread Chris Angelico
On Sat, Feb 8, 2014 at 8:06 PM, Igor Korot ikoro...@gmail.com wrote:
 P.S.: Maybe its a problem with the datetime module which formats the
 datetime incorrectly?

No, I'm pretty sure datetime.datetime really is meant to be working
with microseconds. I'm not very familiar with MySQLdb, haven't used it
in years; it could be a bug there, or it could be something different
again.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: datetime formatting output

2014-02-08 Thread Igor Korot
Thank you Chris.


On Sat, Feb 8, 2014 at 1:10 AM, Chris Angelico ros...@gmail.com wrote:

 On Sat, Feb 8, 2014 at 8:06 PM, Igor Korot ikoro...@gmail.com wrote:
  P.S.: Maybe its a problem with the datetime module which formats the
  datetime incorrectly?

 No, I'm pretty sure datetime.datetime really is meant to be working
 with microseconds. I'm not very familiar with MySQLdb, haven't used it
 in years; it could be a bug there, or it could be something different
 again.

 ChrisA
 --
 https://mail.python.org/mailman/listinfo/python-list

-- 
https://mail.python.org/mailman/listinfo/python-list