# Using Python for date calculations

Steve Hayes hayesstw at telkomsa.net
Sat Nov 22 06:34:24 CET 2014

```On Fri, 21 Nov 2014 15:07:39 -0500, Denis Beauregard
<denis.b-at-francogene.com at fr.invalid> wrote:

>On Fri, 21 Nov 2014 14:35:14 -0500, Dennis Lee Bieber
><bieber.genealogy at earthlink.net> wrote in soc.genealogy.computing:
>
>>On Fri, 21 Nov 2014 10:35:19 +0200, Steve Hayes <hayesstw at telkomsa.net>
>>declaimed the following:
>>
>>
>>>This Python script does it for me.
>>>
>>>year = input("Year: ")
>>>age = input("Age: ")
>>>born = year-age
>>>print 'Year of birth:', born
>>>
>>>It's so simple, so elementary, that it's not really worth writing about,
>>>except for the fact that it illustrates the KISS principle.
>>>
>>	And it is wrong since it doesn't take into account the month.
>>
>>	2014 - 55 => 1959
>>
>>	But I was born in April of 1958, so any calculation done for
>>January/February/March (and the first week of April) is going to produce
>>the incorrect year (I /was/ 55 in January of 2014...)
>
>I made a lot of automated computations from census. In Quebec, we
>have censuses for 1666, 1667 and 1681, and also ages in some marriage
>records, marriage contracts, burials, and some more records. In
>Acadia, there are other old censuses.
>
>Sometimes, the result is accurate, i.e. there is a known baptism
>and the age is matching, but in many cases either the age is not
>matching or the year of birth is changing a lot depending on the
>record. So, if the computation is made to give a hint about the
>birth year, then the month is irrelevant. The result will be
>"about that year" and not "that year". In the database I sell, I
>write exactly that, i.e. (actual example, from Acadian censuses) :
>
>Germain, born about 1650 (census 1671), 1652 (census 1686) (census
>1693), 1650 (census 1698) or 1649 (census 1699)
>
>Marguerite, born about 1658 (census 1671), 1660 (census 1693), 1658
>(census 1698) or 1661 (census 1699)

Exactly!

In this kind of thing one is lookinng for a "ballpark" figure, not a
super-accurate one.

--
Steve Hayes from Tshwane, South Africa
Web:  http://www.khanya.org.za/stevesig.htm
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk

```