fix:格式化某一月
This commit is contained in:
parent
89f05ee8e8
commit
20881c4e4e
|
@ -190,7 +190,42 @@ tool.dateFormat1 = function (date) {
|
|||
newDate = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;
|
||||
return newDate;
|
||||
}
|
||||
|
||||
// 格式化某一天
|
||||
tool.dateFormat2 = function (date) {
|
||||
date = new Date(date);
|
||||
let newDate = '';
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
let day = date.getDate();
|
||||
month = month > 9 ? month : '0' + month;
|
||||
day = day > 9 ? day : '0' + day;
|
||||
newDate = year+'-'+month+'-'+day;
|
||||
return newDate;
|
||||
}
|
||||
// 格式化某一月
|
||||
tool.dateFormat2 = function (date) {
|
||||
date = new Date(date);
|
||||
let first = '';
|
||||
let lastDate = '',year2 = '',month2 = '';
|
||||
let year = date.getFullYear();
|
||||
let month = date.getMonth() + 1;
|
||||
if (month < 12) {
|
||||
year2 = year;
|
||||
let mon = month + 1;
|
||||
month2 = mon > 9 ? mon : '0' + mon;
|
||||
} else {
|
||||
year2 = year + 1;
|
||||
month2 = '01';
|
||||
}
|
||||
|
||||
month = month > 9 ? month : '0' + month;
|
||||
first = year + '-' + month + '-01';
|
||||
lastDate = year2 + '-' + month2 + '-01';
|
||||
let arr = [];
|
||||
arr.push(first)
|
||||
arr.push(lastDate)
|
||||
return arr;
|
||||
}
|
||||
/* 千分符 */
|
||||
tool.groupSeparator = function (num) {
|
||||
num = num + '';
|
||||
|
|
Loading…
Reference in New Issue