<!--
Example File From "JavaScript and DHTML Cookbook"
Published by O'Reilly & Associates
Copyright 2003 Danny Goodman
-->
function getDaysBefore(year, month, date) {
var oneMinute = 60 * 1000;
var oneHour = oneMinute * 60;
var oneDay = oneHour * 24;
var today = new Date();
var targetDate = new Date();
targetDate.setYear(year);
targetDate.setMonth(month);
targetDate.setDate(date);
alert(targetDate);
var diff = targetDate.getTime() - today.getTime();
diff = Math.floor(diff/oneDay);
return diff;
}
|