diff --git a/server/common/timer.js b/server/common/timer.js index d365b06a1d00d11ca57fd4ff3b7a6723490da4a8..a86d21bf159312453a08ecf987684fee4b8b6b83 100644 --- a/server/common/timer.js +++ b/server/common/timer.js @@ -6,12 +6,14 @@ function getCurTime() { let curtime = Date.now(); curtime += gTimer.offsetTime; return curtime; + //1617621849904 } gTimer.getCurTime = getCurTime; function getCurDate() { let cuttime = getCurTime() return new Date(cuttime); + //Mon Apr 05 2021 19:24:50 GMT+0800 (中国标准时间) } gTimer.getCurDate = getCurDate; @@ -29,6 +31,7 @@ function DateFormat(time) { var s = date.getSeconds(); s = s < 10 ? ('0' + s) : s; return y + '-' + m + '-' + d + ' ' + h + ':' + mi + ':' + s; + //2021-04-05 19:21:58 } gTimer.DateFormat = DateFormat; @@ -58,6 +61,7 @@ function getYearDay(date) { // 获取距离1月1日过去多少天 var days = Math.ceil(date - lastDay) / (1000 * 60 * 60 * 24); return days; + } gTimer.getYearDay = getYearDay; @@ -68,4 +72,24 @@ function getYearWeek(date) { } gTimer.getYearWeek = getYearWeek; + +function getMinutes(date){ //date = 1617621849904 + return new Date().getMinutes(date); +} + +gTimer.getMinutes = getMinutes; + +function getSeconds(date){//date = 1617621849904 + return new Date().getSeconds(date); +} +gTimer.getSeconds = getSeconds; + + +function getMonth(date){//date = 1617621849904 + return (new Date().getMonth(date))+1; +} +gTimer.getMonth = getMonth; + + + global.gTimer = gTimer; \ No newline at end of file