<script>
function calcDate() {
var today = new Date();
var past = new Date(2010,05,01);
var diff = Math.floor(today.getTime() - past.getTime());
var day = 1000 * 60 * 60 * 24;
var days = Math.floor(diff/day);
var months = Math.floor(days/31);
var years = Math.floor(months/12);
var message = past.toDateString();
message += " was "
message += days + " days "
message += months + " months "
message += years + " years ago \n"
alert(message);
return false;
}
</script>
function calcDate() {
var today = new Date();
var past = new Date(2010,05,01);
var diff = Math.floor(today.getTime() - past.getTime());
var day = 1000 * 60 * 60 * 24;
var days = Math.floor(diff/day);
var months = Math.floor(days/31);
var years = Math.floor(months/12);
var message = past.toDateString();
message += " was "
message += days + " days "
message += months + " months "
message += years + " years ago \n"
alert(message);
return false;
}
</script>
No comments:
Post a Comment