Calculating Year, Month and Day of Life

hokiegal99 hokiegal99 at hotmail.com
Sat Jul 5 18:10:02 EDT 2003


Ian Bicking wrote:

> On Sat, 2003-07-05 at 12:48, hokiegal99 wrote:
> 
>>Hello,
>>
>>I am a funeral director trying to write a small program that calculates 
>>the number of years, months and days a person has lived by entering the 
>>year, month and day of their birth. This is what I have so far:
> 
> 
> You might want to look at mxDateTime, or Python 2.3's datetime module,
> which will probably provide functions to make this calculation
> significantly easier -- counting days in years, adjusting for leap
> years, etc.  Well, that's if you want to be exact, which may not really
> be important.
> 
>   Ian

This is a good point. I want to be within the correct year, month and 
day, but if I'm off by a few hours it won't matter. From my 
calculations, the average year is 365.25 days long (with a leap year 
every 4 years) so that makes the avergae month 30.4375 days long. Do you 
see any problem with doing it this way?





More information about the Python-list mailing list