getday.js
来自「BI经营分析系统基于Hyperion Analyzer 前端展现层完整代码」· JavaScript 代码 · 共 40 行
JS
40 行
var day_value1;
var day_value2;
var day_value3;
//得到今天的年,月,日
function getToday(n) {
this.now = new Date();
this.year = this.now.getFullYear();
this.month = this.now.getMonth()+1;
this.day = this.now.getDate();
if (n==1) return this.year;
if (n==2) return this.month;
if (n==3) return this.day;
day_value=""+this.year+"-"+(this.month+1)+"-"+this.day;
}
function getYesterday(n) {
this.now = new Date();
this.yesterday = this.now;
this.year = this.yesterday.getFullYear();
this.month = this.yesterday.getMonth()+1;
this.day = this.yesterday.getDate();
if (n==1) return this.year;
if (n==2) return this.month;
if (n==3) return (this.day);
day_value=""+this.year+"-"+(this.month+1)+"-"+(this.day);
}
function getOneDay(day,n) {
day = day.replace(/-/g,"/");
this.now = new Date(day);
this.year = this.now.getFullYear();
this.month = this.now.getMonth()+1;
this.day = this.now.getDate();
if (n==1) return this.year;
if (n==2) return this.month;
if (n==3) return this.day;
day_value=""+this.year+"-"+(this.month+1)+"-"+this.day;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?