On 16 Feb 2010, at 08:51 , harryos wrote:
> 
> thanks ,that worked..
> 
> any idea about calculating the duration? I can do a - between two
> datetime.datetime objects to get a timedelta.. but that doesn't work
> with datetime.time objects
Nope, seems datetime.time doesn't define __add__ and __sub__. Apparently, only 
datetime.datetime and datetime.date support timedelta-type operations (which 
kind-of makes sense, as timedeltas can span days).

You have the option of converting to a datetime via time.strftime and 
datetime.strptime, even though it's ugly and probably quite inefficient:

    >>> t
    datetime.time(8, 56, 20, 653330)
    >>> datetime.strptime(t.strftime('%H:%M:%S'), '%H:%M:%S')
    datetime.datetime(1900, 1, 1, 8, 56, 20)

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to