var target = document.getElementById('target'); function getTimeString(){ // 要计算任意两个日期的时间差只要修改currentDate和currentYearDate的值即可 var currentDate = new Date(); var year = currentDate.getFullYear(); var currentYearDate = new Date(year,11,30,23,59,59); //这