Website Copyright Date Update Image

Website Copyright Date Update


Website Copyright Date Update Image

As each year comes to an end and a new one begins websites have outdated copyright dates. Some web designers will take the month of January to update the dates for their client’s footers to reflect the new year, while others may charge an “update” fee.

There are two options you can use to automatically update the copyright date so you can set it and forget it. You can either use JavaScript or PHP to handle this change for you. We will take a look at each option below:

JavaScript is a versatile language that every web browser can read without any special features or add-ons.
A simple script in the footer section will use the current year as shown in this example:

Code Image

<script type="text/javascript">
        document.write(new Date().getFullYear());
</script>
        

Results in the following output:
2019

To make the copyright look better try this:

Code Image

© <script type="text/javascript">
        document.write(new Date().getFullYear());
<script>
        

Results in the following output:
© 2019

I usually add the following:

Code Image

<div class="copyright">
<p class="text-center">© 2017 - 
    <script type="text/javascript">
        document.write(new Date().getFullYear());
    </script> 
    Company Name. All Rights Reserved.</p></div> 
        

Results in the following output:
© 2017 - 2019 Company Name. All Rights Reserved.

PHP the other option to accomplish the automated date change. In order to use the PHP option you will need two things; PHP installed on the web server and the file name saved as a php file. Example: index.php

Code Image

© 2017 - <?php echo date("Y"); ?> Company Name. All rights reserved.    
        

Results in the following output:
© 2017 - 2019 Company Name. All Rights Reserved.

Still, have questions? We are here to help and assist you, send us an email and drop us a note on our Contact form.