//获取最近7天日期 getDay(0);//当天日期 getDay(-7);//7天前日期 //获取最近3天日期 getDay(0);//当天日期 getDay(-3);//3天前日期 function getDay(day){ var today = new Date(); var targetday_milliseconds=today.getTime() + 1000*60*60*24*day; today.setTime(targetday_milliseconds); //注意,这行
在开发当中遇到了一个关于echarts初始展示当前前7天的数据,正好记录一下如何获取前"n"天的日期, 返回时间格式:2020-02-02 // 返回前number天的日期格式为2020-02-02,参数number为前几天 getBeforeDate(number) { const num = number; const date = new Date(); let year = date.getFullYear(); let mon = date.getMonth() + 1; l
Extjs4 获取到前一天的日期 Extjs官方示例 Ext.Date add( date, interval, value ) : Date Provides a convenient method for performing basic date arithmetic. This method does not modify the Date instance being called - it creates and returns a new Date instance contain