카타 8급 Is the date today

1 개요[ | ]

카타 8급 C
# 🔗 문제 풀이

틀:카타 8급-17

2 JavaScript[ | ]

function isToday(date) {
  return new Date().toDateString() == date.toDateString();
}
function isToday(date) {
  return new Date().toString().substr(0, 15) == date.toString().substr(0, 15);
}
function isToday(date) {
  var today = new Date();
  if( date.getDate() != today.getDate() ) return false;
  if( date.getMonth() != today.getMonth() ) return false;
  if( date.getFullYear() != today.getFullYear() ) return false;
  return true;
}
문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}