JS显示网站运行天数代码_js日期计算.
<a>本站已经运行<a id="days">0</a>天</a> <script> var s1 = '2015-08-24';//设置为你的建站时间 s1 = new Date(s1.replace(/-/g, "/")); s2 = new Date(); var days = s2.getTime() - s1.getTime(); var number_of_days = parseInt(days / (1000 * 60 * 60 * 24)); document.getElementById('days').innerHTML = number_of_days; </script>