CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
Calculating the age of a person



Sep 22, 2000, 11:37 AM

Post #1 of 2 (421 views)
Calculating the age of a person Can't Post

I would like to know how to create a script that calculates the age of a person. The script must take the actual date from a variable taken from function (I don't know if it is localtime or time) and substract it with the birthdate (Provided by a database).
For example I have:
$today =??????
$age = $today-$row[3]

The bithdate format is dd-mm-yyyy

Thank you very much for your help!!

User / Moderator

Sep 23, 2000, 7:19 PM

Post #2 of 2 (421 views)
Re: Calculating the age of a person [In reply to] Can't Post

Use Date::Manip or Date::Calc which have already been mentioned a few times on the board.

Alternately, if your database is a SQL database, read up on its documentation as they usually provide some way of doing date calculations in your query itself.


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives