Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #81184
| Path | csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed2.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <gary.herron@islandtraining.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.081 |
| X-Spam-Evidence | '*H*': 0.84; '*S*': 0.00; 'python.': 0.02; 'subject:Python': 0.06; 'steve': 0.09; "person's": 0.09; 'received:67.192': 0.09; 'received:67.192.241': 0.09; 'received:dfw.emailsrvr.com': 0.09; 'things,': 0.09; 'wrong,': 0.09; 'python': 0.11; 'calculator': 0.16; 'hayes': 0.16; 'illustrates': 0.16; 'when,': 0.16; 'wrote:': 0.18; 'module': 0.19; 'python?': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'received:emailsrvr.com': 0.24; "i've": 0.25; 'script': 0.25; 'received:(smtp server)': 0.26; 'header:In-Reply-To:1': 0.27; 'am,': 0.29; 'usually': 0.31; 'gary': 0.31; 'anyone': 0.31; 'worked': 0.33; 'url:python': 0.33; "can't": 0.35; 'except': 0.35; 'something': 0.35; 'convert': 0.35; 'but': 0.35; 'there': 0.35; 'really': 0.36; 'dates': 0.36; 'done': 0.36; 'url:org': 0.36; 'too': 0.37; 'easily': 0.37; 'sometimes': 0.38; 'url:library': 0.38; 'to:addr:python-list': 0.38; 'fact': 0.38; 'that,': 0.38; 'does': 0.39; 'to:addr:python.org': 0.39; 'simple,': 0.60; 'matter': 0.61; 'course': 0.61; 'simple': 0.61; "you've": 0.63; 'pick': 0.64; 'more': 0.64; 'finally': 0.65; 'charset:windows-1252': 0.65; 'worth': 0.66; 'research,': 0.68; 'records,': 0.69; 'programs,': 0.74; 'age': 0.80; 'hand': 0.80; 'age.': 0.84; 'census': 0.84; 'kiss': 0.84; 'mention.': 0.84; 'much,': 0.84; 'subject:Using': 0.84; 'understand,': 0.84; 'birth': 0.91; 'average': 0.93 |
| X-Virus-Scanned | OK |
| X-Sender-Id | gary.herron@islandtraining.com |
| Date | Fri, 21 Nov 2014 00:50:13 -0800 |
| From | Gary Herron <gary.herron@islandtraining.com> |
| User-Agent | Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
| MIME-Version | 1.0 |
| To | python-list@python.org |
| Subject | Re: Using Python for date calculations |
| References | <k7tt6aheccqv06enkume0vs0v6kvvhns45@4ax.com> |
| In-Reply-To | <k7tt6aheccqv06enkume0vs0v6kvvhns45@4ax.com> |
| Content-Type | text/plain; charset=windows-1252; format=flowed |
| Content-Transfer-Encoding | 7bit |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.16089.1416560232.18130.python-list@python.org> (permalink) |
| Lines | 44 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1416560232 news.xs4all.nl 2906 [2001:888:2000:d::a6]:48944 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:81184 |
Show key headers only | View raw
On 11/21/2014 12:35 AM, Steve Hayes wrote:
> I've finally found a use for Python.
>
> When, in the course of my genealogy research, I look at census or burial
> records, I often want to work out a person's date of birth from their age.
> It's a simple matter of mental arithmetic, but I sometimes get it wrong, and
> mislead myself. There are calculators and date calculation programs, but they
> are usually too complicated and try to do too much, so by the time you've
> worked out what to do it takes much longer.
>
> 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.
>
> It is sometimes better to have a simple program that does one thing well than
> a complex one that does lots of things, but none of them very efficiently.
>
> The average hand calculator can do the same job, but you have to pick it up
> and put it down, and you can't easily see if you've made a typo.
>
> Having said that, however, yes, I would perhaps like to use Python for more
> complicated date processing routines, namely to convert the kinds of dates
> produced by genealogy programs to a simple yyyy-mm-dd that computer database
> programs can understand, so that "Abt May 1677" would be rendered as
> "1677-05-00"
>
> Has anyone done something like that in Python?
>
>
>
The datetime module has lots of capabilities including the several you
mention.
See https://docs.python.org/2/library/datetime.html
Gary Herron
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