Forum Moderators: open
<!DOCTYPE html>
<html>
<head>
<title>Test Date</title>
</head>
<body>
<script>
var currentDate = new Date();
// getTime returns the time in millisecond format
// to calculate 7 days, start with the smallest unit and keep multiplying
// 1000ms = 1 second
// 1 second * 60 = 1 minute
// 1 minute * 60 = 1 hour
// 1 hour * 24 = 1 day
// 1 day * 7 = 7 days
var datePlus7d = new Date(currentDate.getTime() + (1000 * 60 * 60 * 24 * 7));
alert("Today is " + currentDate.toLocaleDateString() + "\n7 days from now is " + datePlus7d.toLocaleDateString());
</script>
</body>
</html>
// add Date Pickers
if ($('.datepicker').length > 0) {
var date_format = 'yy/mm/dd'
var max_date = $.datepicker.parseDate(date_format, $('#latest_date').attr('value'));
$(".datepicker").datepicker( {
dateFormat : date_format,
minDate : new Date(2011, 3, 1) ,
beforeShowDay : $.datepicker.noWeekends,
maxDate : max_date
});
}