Automate the date of your footer

On 1 January, we often have other things to do than change the date in the footer of our sites... So let's use JavaScript or PHP to automate it!
•
Updated on August 14, 2026
•
1 min read
Believemy logo

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!

HTML
<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.

HTML
<footer>
    <p>
        ©
        <span id="footer-year"></span>
        BELIEVEMY
    </p>
</footer>

And on the JavaScript side:

JAVASCRIPT
const footerYear = document.querySelector('#footer-year');

footerYear.innerHTML = new Date().getFullYear();
Category: Developers

Share this article

Want to help us? Share this article on your networks or even better: on your site, in an article or in your newsletter.

Believemy logo
Comments (0)

You need to be logged in to comment on this article: log in or sign up.

Read next

Creating a clock using JavaScript

Imagine a clock that shows the time to your users, on a travel site for example, with the time zone of the destination country? Let's create this magnificent clock together, using JavaScript!

December 9, 2024

How can you use CSS variables to make everything more dynamic?

Perhaps you've already had that moment when you wanted to change the main colour of one of your projects? Or perhaps you've already experienced those moments when you go back to retrieve the colours of your site's theme? It's all very time-consuming and impractical. Thanks to CSS variables, this will be a thing of the past! Let's find out how.

December 9, 2024

Create a live counter of Instagram followers

Here's how to create a live Instagram follower counter that updates automatically every second! Very useful for your websites! We're using the very latest JavaScript feature: fetch!

December 9, 2024

Make an animated notification message with JavaScript

Whether it's to quickly warn your users that a feature of your site is not yet available or to let them know that an action has been successfully completed, notifications are the simplest and most modern way to set up. Find out how in this article!

December 9, 2024

Display a number progressively on a counter with JavaScript

When we have numbers to display, we often present them blandly and without animation. And yet: creating an animation that progressively displays the final number is very easy to do and will enable you to liven up your numbers! Let's see how in this article.

December 11, 2024

Creating a skeleton with JavaScript

Let's find out together how to create a loading effect on our elements during an AJAX call, for example!

December 9, 2024

Create an animated gradient background on hover avec CSS

Whether it's to highlight a part of your website or a quote as in this example, generating and adding a gradient to the background can give your website a very modern touch. Find out in this article how to do it easily!

December 9, 2024

Creating a sinking button with CSS

The buttons on a site are the main triggers for action: styling them and making them dynamic is very important in your development process! That's the aim of this article.

December 9, 2024

Become the solopreneur you dream of being.

First project, career change, business launch: access our courses, practice on real-world cases, and move forward with clear guidance.