Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #81244

Re: Using Python for date calculations

From Paul Blair <p.blair@internode.on.net>
Newsgroups soc.genealogy.computing, comp.lang.python
Subject Re: Using Python for date calculations
Date 2014-11-22 06:51 +1100
Organization A noiseless patient Spider
Message-ID <m4o53h$jro$1@dont-email.me> (permalink)
References <k7tt6aheccqv06enkume0vs0v6kvvhns45@4ax.com> <5l4v6a1kp9chnv9lmie3sb8b1ko69kjem3@4ax.com>

Cross-posted to 2 groups.

Show all headers | View raw


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

Paul

Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


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