判断时间是否是当天
function isToday(date) {
return new Date().toDateString() === date.toDateString();
}
function isToday(date) {
//Code goes here.
var d = new Date(date.toString().replace(/-/g,"/"));
var todaysDate = new Date();
if(d.setHours(0,0,0,0) == todaysDate.setHours(0,0,0,0)){
return true;
} else {
return false;
}
}
function isToday(date) {
return new Date().toString().substr(0, 15) === date.toString().substr(0, 15);
}
function isToday(date) {
return date.toString().slice(0, 10) === new Date().toString().slice(0, 10);
}
本文仅提供参考,是本人闲时所写笔记,如有错误,还请赐教,作者:阿蒙不萌,大家可以随意转载


浙公网安备 33010602011771号