<script data-no-instant>
function show_date_time(){window.setTimeout("show_date_time()",1e3);
var BirthDay=new Date("2018/11/05 00:00:00"),
today=new Date,timeold=today.getTime()-BirthDay.getTime(),msPerDay=864e5,
e_daysold=timeold/msPerDay,daysold=Math.floor(e_daysold),
e_hrsold=24*(e_daysold-daysold),
hrsold=Math.floor(e_hrsold),
e_minsold=60*(e_hrsold-hrsold),
minsold=Math.floor(60*(e_hrsold-hrsold)),
seconds=Math.floor(60*(e_minsold-minsold));
span_dt_dt.innerHTML="博客已运行"+daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒";}
show_date_time();
</script>
<div style="color:blue" id ="span_dt_dt"></div>
-->
博客底部增加网站已经运营时间,可以精确到时分秒,效果请看本博底部
下面是相关的代码,复制到footer.php即可
<script data-no-instant>
function show_date_time(){window.setTimeout("show_date_time()",1e3);
var BirthDay=new Date("2018/11/05 00:00:00"),
today=new Date,timeold=today.getTime()-BirthDay.getTime(),msPerDay=864e5,
e_daysold=timeold/msPerDay,daysold=Math.floor(e_daysold),
e_hrsold=24*(e_daysold-daysold),
hrsold=Math.floor(e_hrsold),
e_minsold=60*(e_hrsold-hrsold),
minsold=Math.floor(60*(e_hrsold-hrsold)),
seconds=Math.floor(60*(e_minsold-minsold));
span_dt_dt.innerHTML="博客已运行"+daysold+"天"+hrsold+"小时"+minsold+"分"+seconds+"秒";}
show_date_time();
</script>
<div style="color:blue" id ="span_dt_dt"></div>