I'm working on a web site which contain a form; in that form i ask the users to introduce their birthday date and i want to calculate their age automatically but i have a problem with the format of the date introduced by the user which is DD/MM/YYYY and i want to convert the format of the date now to the same.
here's the code i wrote:
function calculAge()
{
var a = new Date();
a = document.getElementById("dat").value ;
var b = new Date();
var c = b - a;
c = Math.round(c / (1000 * 60 * 60 * 24));
alert(c);
document.getElementById("age").innerHTML = "Votre age est "+c;
}
Thanks