auto update copyright year javascript

Hello developers! In this article I have shared the details about “auto update copyright year javascript”. Okay, let’s move on to the article.

auto update copyright year javascript

<div class="copyright">
  <footer>Copyright © <span id="year"></span> , All rights reserved to X</footer>
</div>
<script>
  
  function getCurrentYear() 
    return new Date().getFullYear(); // returns the year via local timing
  ;

  document.getElementById("year").innerHTML = getCurrentYear(); 
  //changing the inner html of the span with "year" id to the given year(2021)
</script>

Conclusion

I hope this tutorial helps you to know about “auto update copyright year javascript”. If you have any questions regarding this tutorial please let us know via the comment section. Share this post with your friends & family via social networks.

Hi, I'm Ranjith a full-time Blogger, YouTuber, Affiliate Marketer, & founder of Coder Diksha. Here, I post about programming to help developers.

Share on:

Leave a Comment