Jump to content

Recommended Posts

The thought that a lot of people have all ready created a function to do just that came to my mind and yup that function can be found with google.

http://www.javascriptkit.com/script/script2/calculateage.shtml

 

just a matter of linking the functions togehter and your done

Link to comment
https://forums.phpfreaks.com/topic/57453-age-calculation/#findComment-284353
Share on other sites

Hi, Thanks for the link.

 

If I was confident enough with javascript I would have figured it out by now. Its not exactly overcoming the problem that when Iv selected the date, I need to calculate the age from a dd-mm-yyyy format (if I could explosed the date like I would in php I wouldnt have an issue).

 

Any ideas? Take a date from dd-mm-yyyy in an input box and explode it to format: displayage(yyyy, mm dd, "years", 0, "rounddown")

 

?

Link to comment
https://forums.phpfreaks.com/topic/57453-age-calculation/#findComment-284879
Share on other sites

Javascript split maybe  ;) if the input value is a string that is

function divide_string()
{
var dateInString="12-01-2001";
var date_array=dateInString.split("-");
alert("day="+date_array[0]+" month="+date_array[1]+" year="+date_array[2]);
}

Link to comment
https://forums.phpfreaks.com/topic/57453-age-calculation/#findComment-285124
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.