在主题设置中找到个性化页脚内容设置框,填写如下代码即可
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
| <script> function runTime() { birthday = new Date('2020-05-01 00:00:00'); now = new Date(); timeold = (now.getTime() - birthday.getTime()); msperday = 24 * 60 * 60 * 1000 msperhour = 60 * 60 * 1000 msperminute = 60 * 1000 daysold = Math.floor(timeold / msperday); str = daysold + '天' timeold = timeold - daysold * msperday hoursold = Math.floor(timeold / msperhour); str += hoursold + '时' timeold = timeold - hoursold * msperhour minutesold = Math.floor(timeold / msperminute); str += minutesold + '分' timeold = timeold - minutesold * msperminute secondsold = Math.floor(timeold / 1000); str += secondsold + '秒' return str } setInterval(function () {$('#run_time').html(runTime())}, 1000); </script> <span>本博客已运行:<span id="run_time"></span></span>
|
基于CSDN博主「潘超博客」的原创文章修改
原文链接:https://blog.csdn.net/panchao888888/article/details/91129368