fix:tool中修改格式化日期方法

This commit is contained in:
shijing 2024-11-22 10:00:29 +08:00
parent b92937fb9b
commit 4e1a6901fd
1 changed files with 3 additions and 2 deletions

View File

@ -173,6 +173,7 @@ tool.dateFormat = function (date, fmt='yyyy-MM-dd hh:mm:ss') {
} }
return fmt; return fmt;
} }
// YYYY-MM-DD hh:mm:ss
tool.dateFormat1 = function (date) { tool.dateFormat1 = function (date) {
date = new Date(date); date = new Date(date);
let newDate = ''; let newDate = '';
@ -190,7 +191,7 @@ tool.dateFormat1 = function (date) {
newDate = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second; newDate = year+'-'+month+'-'+day+' '+hour+':'+minute+':'+second;
return newDate; return newDate;
} }
// 格式化某一天 // YYYY-MM-DD 格式化某一天
tool.dateFormat2 = function (date) { tool.dateFormat2 = function (date) {
date = new Date(date); date = new Date(date);
let newDate = ''; let newDate = '';
@ -203,7 +204,7 @@ tool.dateFormat2 = function (date) {
return newDate; return newDate;
} }
// 格式化某一月 // 格式化某一月
tool.dateFormat2 = function (date) { tool.monthFormat = function (date) {
date = new Date(date); date = new Date(date);
let first = ''; let first = '';
let lastDate = '',year2 = '',month2 = ''; let lastDate = '',year2 = '',month2 = '';