How to find difference in years between two dates?

Bruno Desthuilliers onurb at xiludom.gro
Fri Jul 28 04:54:08 EDT 2006


thebjorn wrote:
> Bruno Desthuilliers wrote:
>> Which conversion ? How do you get the data ? as a datetime object ? as a
>> (y,m,d) tuple ? as a "y-m-d" string ? Else ?
> 
> All input routines, whether they're from a web-form, database, command
> line, or anywhere else, only produce objects from the datetime module
> for calendar data.

Seems quite sensible.

> That way the program logic doesn't have to guess
> which format it's getting... I suppose I could do something like:
> 
>    def age(born):
>         mx_born = mx.DateTime.Date(born.year, born.month, born.day)
>         ...

Yes, I was thinking of something like this.

> -- bjorn
> 


-- 
bruno desthuilliers
python -c "print '@'.join(['.'.join([w[::-1] for w in p.split('.')]) for
p in 'onurb at xiludom.gro'.split('@')])"



More information about the Python-list mailing list