On Aug 3, 2007, at 9:57 AM, Doug Van Horn wrote:

>>>> def age(d, bday):
> ...     return (d.year - bday.year) - \
> ...         ((d.month, d.day) < (bday.month, bday.day) and 1 or 0)

Or to be a little more explicit about it:

def age(d, bday):
     return (d.year - bday.year) - \
                 int((d.month, d.day) < (bday.month, bday.day))

int(True) => 1, int(False) => 0


--~--~---------~--~----~------------~-------~--~----~
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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to