标签:als 日期时间 min UNC minutes lse tor obj lld
function getCurrentDate(fulldate = false, separator = [‘-‘, ‘:‘]) { let currentTimeObj = new Date(); let year = currentTimeObj.getFullYear(); let month = (currentTimeObj.getMonth() + 1); month = month >= 10 ? month : ‘0‘ + month; let day = currentTimeObj.getDate(); day = day >= 10 ? day : ‘0‘ + day; let hour = currentTimeObj.getHours(); hour = hour >= 10 ? hour : ‘0‘ + hour; let minute = currentTimeObj.getMinutes(); minute = minute >= 10 ? minute : ‘0‘ + minute; let second = currentTimeObj.getSeconds(); second = second >= 10 ? second : ‘0‘ + second; if (fulldate) { let ymd = [year, month, day]; let his = [hour, minute, second]; return ymd.join(separator[0]) + ‘ ‘ + his.join(separator[1]); } else { let ymd = [year, month, day]; return ymd.join(separator[0]); } }
标签:als 日期时间 min UNC minutes lse tor obj lld
原文地址:https://www.cnblogs.com/nonsec/p/9486097.html