Automate the date of your footer
On January 1st, we often have other things to do than manually updating the footer date on our websites... So let's use JavaScript or PHP to automate it!
You can find the entire tutorial on our Instagram account
With PHP
If you want to automate the date in your footer, doing it with PHP is undoubtedly one of the simplest methods!
<footer>
<p>
© <?= date('Y'); ?> BELIEVEMY
</p>
</footer>
With JavaScript
You can also use JavaScript to automate the date in your footer. The downside is that you'll have to do it with numerous lines of code, but the advantage is that you don't need to master PHP. So it's an interesting alternative.
<footer>
<p>
©
<span id="footer-year"></span>
BELIEVEMY
</p>
</footer>
And on the JavaScript side:
const footerYear = document.querySelector('#footer-year');
footerYear.innerHTML = new Date().getFullYear();