本站代码模板仅供学习交流使用请勿商业运营,严禁从事违法,侵权等任何非法活动,否则后果自负!

<script>
// 请替换为网站实际开始运行的时间(格式:年, 月-1, 日, 时, 分, 秒)
const startTime = new Date(2023, 0, 1, 0, 0, 0);
function updateRunTime() {
const now = new Date();
const timeDiff = now - startTime; // 计算时间差(毫秒)
// 转换为天、时、分、秒
const days = Math.floor(timeDiff / (1000 * 60 * 60 * 24));
const hours = Math.floor((timeDiff % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
const minutes = Math.floor((timeDiff % (1000 * 60 * 60)) / (1000 * 60));
const seconds = Math.floor((timeDiff % (1000 * 60)) / 1000);
// 更新页面显示
document.getElementById('safeRunTime').textContent =
`${days}天${hours}时${minutes}分${seconds}秒`;
}
// 首次加载时更新一次,之后每秒更新一次
updateRunTime();
setInterval(updateRunTime, 1000);
</script>

© 版权声明
1. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需。
2. 本站提供的所有资源仅供本地单机参考学习使用,不存在任何商业目的与商业用途,请大家不要用于商用!
3.如果本站有侵犯、不妥之处的资源,请在网站右边客服联系我们。将会第一时间解决!若侵犯到您的权益,请联系站长邮箱:12225150@qq.com 我们会在24h小时之内进行删除处理。THE END
暂无评论内容