<html>
<body>
<p id="demo">Click the button to display the number of years between a specified date and January 1, 1970.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction()
{
var d = Date.parse("March 21, 2012");
var minutes=1000*60;
var hours=minutes*60;
var days=hours*24;
var years=days*365;
var y=Math.round(d/years);
var x = document.getElementById("demo");
x.innerHTML=y;
}
</script>
</body>
</html>