• Home
  • Keep landing Page Dates Current with JavaScript

Keep landing Page Dates Current with JavaScript

Keep landing Page Dates Current with JavaScript

Hopefully, you’re including a Copyright and Date at the bottom of your site. If you’re managing multiple sites, do yourself and/or your clients a favor and implement this code vs logging into each site (or page) manually to update the date.

Here’s the Code:

    <div class="row"><p><a href="https://cypresslearning.com" target="blank">© Cypress Learning Solutions, Inc. <span id="year">2017</span>
        <script>var d = new Date();var n = d.getFullYear();document.getElementById("year").innerHTML = n;</script></a></p>
    </div>

Now, you’ll want to replace all of my Cypress stuff with your own (If you prefer not to, I’ll gladly take the referral links – TIA!) But more particularly, this script will return the current year so you no longer need to manage it statically.

<script>var d = new Date();var n = d.getFullYear();document.getElementById("year").innerHTML = n;</script>

We hope you have some fun and give this a try! Happy Coding!