How to find difference in years between two dates?

John Machin sjmachin at lexicon.net
Fri Jul 28 17:49:54 EDT 2006


thebjorn wrote:
> John Machin wrote:
> > Jan 31 to Feb 27: 27d (ex) 28d (in)
> > Jan 31 to Feb 28: 28d (ex) 1m 1d (in)
> > Jan 31 to Mar 01: 1m 1d (ex) 1m 2d (in)
> > So 1 day short of 1m 1d is not 1m 0 d???
>
> Exactly. Just as a person born on 1999-3-1 isn't a year old on
> 2000-2-29. Perfectly regular, consistent and reasonable.

Is a person born on 1993-08-01 a year old on 1994--07-31?

I don't understand. The examples that I showed went from the last day
of a month to the last day of another month. You justify a manifest
inconsistency in the results by reference to an example that goes from
the first day of a month to the last day of a month??

>
> > I'd call this unreasonable, inconsistent, anomalous -- especially
> > when on the same website you do 1993-01-31 plus 1 month, it
> > gives you 1993-02-28 (as I'd expect).
> 
> You're entitled to your opinion.

And you to yours :-)




More information about the Python-list mailing list