我们有一个电子表格,其中包含我们的员工,其中包含开始日期和结束日期。
我们希望在此期间显示活动员工,但无法使用数据过滤器显示员工开始日期在日期范围之前或期间以及完成日期之前的时间。
答案 0 :(得分:0)
var startDate =' 2016-03-22&#39 ;; //假设
var endDate =' 2015-04-25&#39 ;; //假设
var todayDate = new Date();
var getCurrentMonth = todayDate.getMonth().toString().length == 1 ? '0'+(todayDate.getMonth()+1) : (todayDate.getMonth()+1);
var getCurrentDay = todayDate.getDate();
var getCurrentYear = todayDate.getYear();
var todayDate = getCurrentYear + '-' + getCurrentMonth + '-' + getCurrentDay;
function compare(startDate, endDate) { return todayDate > startDate && todayDate < endDate; } compare();