丢script里
function tick() { var years,days,hours, minutes, seconds; var openday = new Date(‘2020/06/01 00:00’); //这里填写建站时间 var today = new Date(); //获取系统当前时间 var total = (today.getTime()-openday.getTime())/1000; years=Math.floor(total/31536000); total=total-years*31536000; days=Math.floor(total/86400); total=total-days*86400; hours=Math.floor(total/3600); total=total-hours*3600; minutes=Math.floor(total/60); total=total-minutes*60; seconds=Math.floor(total); timeString = "已运行:"+years+"年"+days+"天"+hours+"时"+minutes+"分"+seconds+"秒"; document.getElementById("YClock").innerHTML = timeString; window.setTimeout("tick();", 1000); } window.onload = tick; |