On Sep 2, 12:55 pm, Malcolm Tredinnick <
malc...@pointy-stick.com>
wrote:
> On Tue, 2008-09-02 at 03:16 -0700, JensGrivollawrote:
> > I am getting weird results using django.db to do a "select
> > timediff(a,b)..." query from MySQL. The result is a datetime.datetime
> > object instead of a datetime.timedelta. When using MySQLdb directly,
> > it returns the expected timedelta object.
>
> Are you really getting a datetime.datetime and not a datetime.time? I
> would have expected you might get the latter, since we map any TIME type
> of column to a datetime.time. I can't see how you would be getting a
> datetime, though.
You are right, it's a datetime.time. I'd still rather have a
datetime.timedelta (which seems more logical), mostly because I want
to use the timedelta.seconds attribute. I'm now using
time_to_seconds() in MySQL so I don't have to deal with the time vs.
timedelta issues.
Ciao,
Jens