Xref: utzoo comp.lang.prolog:3063 comp.lang.misc:5392 Path: utzoo!utgpu!news-server.csri.toronto.edu!mailrus!uunet!munnari.oz.au!goanna!ok From: ok@goanna.cs.rmit.oz.au (Richard A. O'Keefe) Newsgroups: comp.lang.prolog,comp.lang.misc Subject: Re: Calculating ages Message-ID: <3583@goanna.cs.rmit.oz.au> Date: 19 Aug 90 23:09:33 GMT References: <982@christopher-robin.cs.bham.ac.uk> Followup-To: comp.lang.prolog Organization: Comp Sci, RMIT, Melbourne, Australia Lines: 17 In article <982@christopher-robin.cs.bham.ac.uk>, cjr@cs.bham.ac.uk (Chris Ridd ) writes: > Does anyone know how to calculate a person's age in Prolog (well, any > language will do)? We are given today's date and their birthday, and > need the answer in years, weeks and days. Look in the book Numerical Recipes, specifically at JULDAT. Or, if you have Quintus Prolog, use library(date). By the way, the answer in "years, weeks, and days" is not well defined. Presumably you mean "subtract the birth date from the last birthday, taking that as _calendar_ years, and take weeks and days since the last birthday". With that definition (completed years + time since last birthday) you only need to worry about whether the current and previous years were leap years. -- The taxonomy of Pleistocene equids is in a state of confusion.