📄 getday.js
字号:
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 + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -