公式的话直接判断如下:
if(DATEDELTA(TODAY(),-5)=a2,"5天","其它")
if(DATEDELTA(TODAY(),-5)>=a2,"5天之内","其它")
如果是js判断的话
var today = new Date();
// 将日期设置为5天前
var yesterday = new Date();
yesterday.setDate(today.getDate() - 5);
// 获取年月日
var year = yesterday.getFullYear();
var month = yesterday.getMonth() + 1; // 月份从0开始计数,所以要加1
var day = yesterday.getDate();
// 输出结果
console.log(year + '-' + (month < 10 ? '0' + month : month) + '-' + (day < 10 ? '0' + day : day));