This commit is contained in:
aozhiwei 2022-09-21 14:41:19 +08:00
parent af9fef2fde
commit 6a6a58c944

View File

@ -78,6 +78,11 @@ function getDaySeconds(time, timeZone) {
3600 * timeZone; 3600 * timeZone;
} }
function getHourSeconds(time, timeZone) {
const daySeconds = getDaySeconds(time, timeZone);
return Math.floor((time - daySeconds) / 3600) * 3600;
}
function formatDate(date) { function formatDate(date) {
const year = date.getFullYear(); const year = date.getFullYear();
const month = date.getMonth() + 1;//月份是从0开始的 const month = date.getMonth() + 1;//月份是从0开始的
@ -257,6 +262,7 @@ exports.isOnlineEnv = isOnlineEnv;
exports.getTickCount = getTickCount; exports.getTickCount = getTickCount;
exports.getUtcTime = getUtcTime; exports.getUtcTime = getUtcTime;
exports.getDaySeconds = getDaySeconds; exports.getDaySeconds = getDaySeconds;
exports.getHourSeconds = getHourSeconds;
exports.formatDate = formatDate; exports.formatDate = formatDate;
exports.pad = pad; exports.pad = pad;
exports.randRange = randRange; exports.randRange = randRange;