new Date()获取当天时间,当天时间 开始 时间和结束时间

var date = new Date();
 var todayYear = date.getFullYear();
 var todayMonth = date.getMonth();
 var today = date.getDate();
 //获取当天的开始时间
new  Date(todayYear ,todayMonth,today,'00','00','00');
//获取当天的结束时间
new  Date(todayYear ,todayMonth,today,'23','59','59');
 //包括当前时间,三天内
  new  Date(todayYear ,todayMonth,today-2,'00','00','00');

你可能感兴趣的:(温故而知新)