Calculate an age

Shane Geiger sgeiger at ncee.net
Sat Dec 8 04:04:24 EST 2007


What is so obvious about dealing with months that vary in length and the
leap-year issue?  Nothing.  If you were born on a day that does not
exist every year (Feb 29th), how old are you on Feb 28th? or Mar 1 of
non-leap years?  If you were born on Feb 29th, then you would be one
month old on March 29th, but would you be one year, one month and one
day old on March 29th of the next year? or would you merely be one year
and one month old?  I believe this is exactly why datetime merely states
deltas in days, not months or years. 


Marc 'BlackJack' Rintsch wrote:
> On Fri, 07 Dec 2007 23:37:23 -0800, Pierre Quentel wrote:
>
>   
>> On Dec 7, 7:09 pm, Dennis Lee Bieber <wlfr... at ix.netcom.com> wrote:
>>
>>     
>>>         How many days in a year? 365.25 (J2000 epoch), 365.2422 [as I
>>> recall](B1900 epoch), 365.0 (non-leap year), 366 (leap year)? Gregorian
>>> or Julian calendar -- and depending upon one's country, the Gregorian
>>> reform may take place at different years.
>>>
>>>         Simple months of (year/12) days, or calendrical mishmash (30 days
>>> hath September, April, June, and November...) again with leap year
>>> exceptions?
>>>
>>>       
>> I don't see where the ambiguity is. Isn't it obvious what we mean by
>> "I am X years, Y months and Z days" ?
>>     
>
> That's obvious but given either the present date or the birth date along
> with that information it's not so clear what the other date may be. 
> Unless you give the info about the used calender systems and the points in
> time (according to which calender system!?) when to use which system.
>
> If you are just asking those questions for people living now (and are
> not called Connor McLeod ;-) and the gregorian calender it's easy but
> providing functions in the standard library for arbitrary date calculation
> involving years is not so easy.
>
> Ciao,
> 	Marc 'BlackJack' Rintsch
>   


-- 
Shane Geiger
IT Director
National Council on Economic Education
sgeiger at ncee.net  |  402-438-8958  |  http://www.ncee.net

Leading the Campaign for Economic and Financial Literacy


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 257 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20071208/acd11c73/attachment.sig>


More information about the Python-list mailing list