[JavaScript] - 判断时间是否是当天
https://www.codewars.com/kata/is-the-date-today/train/javascript
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); }
本文来自博客园,作者:ukyo--君君小时候,转载请注明原文链接:https://www.cnblogs.com/ukzq/p/10321377.html