js封装参数当前时间秒数获取返回后的时间方法
function getTimeAfterSeconds(currentTime, seconds) { const date = new Date(currentTime); date.setSeconds(date.getSeconds() + seconds); return date; }
// example usage const currentTime = new Date(); const timeAfterTenSeconds = getTimeAfterSeconds(currentTime, 10); console.log(timeAfterTenSeconds); // prints the time 10 seconds after current time
原文地址: http://www.cveoy.top/t/topic/fh64 著作权归作者所有。请勿转载和采集!