I had an idea when I was working on the website. I wanted to add a "This website has been running safely for XX days" at the bottom of the website, but I was busy and forgot it later. Today, I checked the information and found that other websites had this tip, so I remembered to put the code on the website. If necessary, I can modify it myself and return it. The code is simple, easy, and does not occupy any resources.
The code is as follows: the html code is placed at the bottom of the website.
<a>This station has been running for<a id="days">0</a>days</a>
The JS code is as follows: the code can be placed before</body>, and the time is your site building time (remember to cancel<script>when you put it in js </script> )
<script> var s1 = '2015-08-08';// Set as your website establishment time 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>
Then modify the display effect according to the style of the website. The default effect is as follows ↓