diff --git a/utils.js b/utils.js index 806077a..f98385c 100644 --- a/utils.js +++ b/utils.js @@ -73,6 +73,11 @@ function getUtcTime() { return Math.floor((new Date()).getTime() / 1000); } +function getDaySeconds(time, timeZone) { + return Math.floor((time + 3600 * timeZone) / 3600 / 24) * 3600 * 24 - + 3600 * timeZone; +} + function formatDate(date) { const year = date.getFullYear(); const month = date.getMonth() + 1;//月份是从0开始的 @@ -251,6 +256,7 @@ exports.throwError = throwError; exports.isOnlineEnv = isOnlineEnv; exports.getTickCount = getTickCount; exports.getUtcTime = getUtcTime; +exports.getDaySeconds = getDaySeconds; exports.formatDate = formatDate; exports.pad = pad; exports.randRange = randRange;