Page 1 of 1

Calculate date of birth from a given age

Posted: Fri Oct 15, 2004 4:13 am
by muppet
Hi Peeps,

I have a db_field storing date of birth (DOB), I would like a user to be able to pull out all records where the DOB means that they are the age that the use has entered as search criteria.

Confused??? I am!!!!!!!

Any suggestions greatfully recieved. 8O

Posted: Fri Oct 15, 2004 5:43 am
by kettle_drum

Code: Select all

SELECT * FROM blah WHERE dob BETWEEN '1969-05-24' AND '1972-09-12'
And you work out what dates to put in the query from whatever the user has selected. If they want people older than 35, take todays date and remove 35 years from it.