js判断时间

var date =new Date();

$("#lastTask-dateTime").val(date.getFullYear() +'-' +formatDate(date.getMonth() +1) +'-' +formatDate(date.getDate()) +' 00:00:00');

function formatDate(num) {

return num >9 ? num :'0' + num;

}


var now =new Date();

str =$("#lastTask-dateTime").val();

var d =new Date(str);

if (now.getFullYear() == d.getFullYear() && now.getMonth() == d.getMonth() && now.getDate() == d.getDate()) {

你可能感兴趣的:(js判断时间)