On 5/8/06, George Sakkis <[EMAIL PROTECTED]> wrote:
>
> I posted this in MySQLdb's tracker but it seems it has to do with
> Django. I have a view with one field being a time difference, computed
> as sec_to_time(unix_timestamp(end)-unix_timestamp(start)). MySQL
> specifies that the return type is TIME, whose values may range from
> '-838:59:59' to '838:59:59'
> (http://dev.mysql.com/doc/refman/5.0/en/time.html) so that it can
> represent time intervals greater than 24 hours or even negative. When I
> run a query on the view through a Django app, I get a ValueError "hour
> must be in 0..23". Is there a way to go around this ?

In a nutshell, MySQL's TIME column corresponds to Python's
datetime.timedelta, i.e. it's a time interval, so that's what MySQLdb
uses. Django's TimeField, OTOH, is a time-of-day field, so it uses
Python's datetime.time. I'm not really sure what the correct fix is
here; suggestions are welcome.

--
The Pythonic Principle: Python works the way it does
because if it didn't, it wouldn't be Python.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to