javascript日期操作
javascript获取给定日期N天后的日期:
<script language="javascript">
function showDate(initDate,num)
{
initDate = initDate.replace('-','/');
var dateObj = new Date(initDate);
dateObj.setDate(dateObj.getDate()+num);
var endDay = dateObj.getDate();
var endMonth = dateObj.getMonth() + 1;
var endYear = dateObj.getYear();
var endDate = endYear + '-' + endMonth + '-' + endDay;
alert(endDate);
}
</script>