LordMerlin
IS-IT--Management
Hi everyone.
I'm trying to incorporate a date of birth to age calculator on my site. Currently I have the following <a href= target=_new>Date Validation Script</a> which validates the date of birth to make sure it's in the dd/mm/yyyy format.
Then, I have the following piece of code, which calculates the age, according to the date of birth
My problem is, this age calculator expects the date format to be mm/dd/yyyy. Is there a way of specifying that my date in the the format of dd/mm/yyyy?
I'm trying to incorporate a date of birth to age calculator on my site. Currently I have the following <a href= target=_new>Date Validation Script</a> which validates the date of birth to make sure it's in the dd/mm/yyyy format.
Then, I have the following piece of code, which calculates the age, according to the date of birth
Code:
<script language="javascript" type="text/javascript">
<!--
function calc(form) {
var today= new Date();
var birthday= new Date(document.form1.dob.value);
secold=(today.getYear()-birthday.getYear())*31557600+(today.getMonth()-birthday.getMonth())*2629800+(today.getDay()-birthday.getDay())*86400+today.getHours()*3600+today.getMinutes()*60+today.getSeconds()
document.form1.age.value=Math.floor(((secold/3600)/24)/365.25);
}
//-->
</script>
My problem is, this age calculator expects the date format to be mm/dd/yyyy. Is there a way of specifying that my date in the the format of dd/mm/yyyy?