Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81273
| From | Steve Hayes <hayesstw@telkomsa.net> |
|---|---|
| Newsgroups | soc.genealogy.computing, comp.lang.python |
| Subject | Re: Using Python for date calculations |
| Date | 2014-11-22 07:31 +0200 |
| Organization | Khanya Publications |
| Message-ID | <kl607alpe7s38fru9of7je9gu6t827v8ir@4ax.com> (permalink) |
| References | <k7tt6aheccqv06enkume0vs0v6kvvhns45@4ax.com> <5l4v6a1kp9chnv9lmie3sb8b1ko69kjem3@4ax.com> <m4o53h$jro$1@dont-email.me> |
Cross-posted to 2 groups.
On Sat, 22 Nov 2014 06:51:15 +1100, Paul Blair <p.blair@internode.on.net>
wrote:
>On 22-Nov-2014 6:35 am, Dennis Lee Bieber wrote:
>> On Fri, 21 Nov 2014 10:35:19 +0200, Steve Hayes <hayesstw@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...)
>>
>> --
>> bieber.genealogy@earthlink.net Dennis Lee Bieber
>> HTTP://home.earthlink.net/~bieber.genealogy/
>>
>
>Have a read of:
>
>http://stackoverflow.com/questions/2217488/age-from-birthdate-in-python
Except that most of those examples seem to assume that you are calculating
from the current date, rather than the date of a census or the date of a
burial. Useful for future reference, perhaps, but not for the immediate
purpose of getting a rough idea of whan a person might have been born (people
also lied about their age on censuses).
There's a date calculator in my Legacy genealogy program, which is doubtless
more accurate, but it takes too many mouse clicks to get there, and then to
get back to where I was.
I've got another nifty little utility called RJT Datecalc, which does the more
accurate stuff, but still has too many options and is too time-consuming.
What I'm beginning to like Python for is the ability to do quick 'n dirty
little scripts for quick 'n dirty little jobs that save time and do what I
need.
For example, I see the age of someone in a UK census, and I want to know
roughly which years I should look for their birth in something like FreeBMD.
If it says 1847, obviously I'll look for a couple of years either side because
chances are they were born in the previous year, and the age might not have
been accurate anyway.
--
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
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-21 10:35 +0200
Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-21 19:40 +1100
Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-21 12:15 +0200
Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-21 21:18 +1100
Re: Using Python for date calculations alister <alister.nospam.ware@ntlworld.com> - 2014-11-21 10:33 +0000
Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-21 21:47 +1100
Re: Using Python for date calculations random832@fastmail.us - 2014-11-21 08:54 -0500
Re: Using Python for date calculations alister <alister.nospam.ware@ntlworld.com> - 2014-11-21 14:54 +0000
Re: Using Python for date calculations random832@fastmail.us - 2014-11-21 08:58 -0500
Re: Using Python for date calculations Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2014-11-22 01:55 +1100
Re: Using Python for date calculations Ned Batchelder <ned@nedbatchelder.com> - 2014-11-21 10:25 -0500
Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-22 01:08 +1100
Re: Using Python for date calculations Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2014-11-21 14:50 -0500
Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-22 07:07 +0200
Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-22 16:13 +1100
Re: Using Python for date calculations Gary Herron <gary.herron@islandtraining.com> - 2014-11-21 00:50 -0800
Re: Using Python for date calculations Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-21 10:20 +0000
Re: Using Python for date calculations alister <alister.nospam.ware@ntlworld.com> - 2014-11-21 10:38 +0000
Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-21 17:50 +0200
Re: Using Python for date calculations Mark Lawrence <breamoreboy@yahoo.co.uk> - 2014-11-21 16:01 +0000
Re: Using Python for date calculations Chris Angelico <rosuav@gmail.com> - 2014-11-21 21:27 +1100
Re: Using Python for date calculations duncan smith <buzzard@invalid.invalid> - 2014-11-21 17:03 +0000
Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-21 21:48 +0200
Re: Using Python for date calculations Dennis Lee Bieber <bieber.genealogy@earthlink.net> - 2014-11-21 15:32 -0500
Re: Using Python for date calculations Dennis Lee Bieber <bieber.genealogy@earthlink.net> - 2014-11-21 14:35 -0500
Re: Using Python for date calculations Paul Blair <p.blair@internode.on.net> - 2014-11-22 06:51 +1100
Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-22 07:31 +0200
Re: Using Python for date calculations Denis Beauregard <denis.b-at-francogene.com@fr.invalid> - 2014-11-21 15:07 -0500
Re: Using Python for date calculations Steve Hayes <hayesstw@telkomsa.net> - 2014-11-22 07:34 +0200
csiph-web