Updating the copyright year on your website may not be a legal requirement, but it's smart marketing. It tells the visitor the site is current. Showing the copyright year is especially important if you have a site without dates on its content.
Entering either script won't change the copyright year in the Design view of your html editor. To see the results of entering your script, upload the edited web page to your web server, then go to your browser and reload the page.
var today = new Date()
var year = today.getFullYear()
And here's the php script:
<?php echo date("Y"); ?>
Yes, the php script is simpler, but it may not work just yet. You first need to take another step to make the php script run on html pages.
You need to create or edit an .htaccess file.
This is not as burdensome as it sounds. It's actually a good thing, because then you'll be able to run other php scripts on your site, which can be extremely useful.
If you're using WordPress, you don't need to edit the .htaccess file. You can skip straight to the Copyright That Spans Several Years section below.
Creating the .htaccess File
To set up an .htaccess file, open a new file in a text editor like Notepad or SimpleText.
Paste the following code into the file:
AddType application/x-httpd-php .htm .html
If you have an existing .htaccess file, open it and add the above code.
Alternatively, search your web host's site for "How to parse php within html files." Follow its instructions on what code to enter in the .htaccess file. (Your web host might specify a different process for parsing php in html pages. Follow those directions instead of the ones here.)
After inserting the code, in Notepad click File > Save As...
Type .htaccess as the file name and from the Save as type dropdown menu, select All Files.
Click Save, then go back and make sure the editor didn't add an extension to the filename after .htaccess. If you find an extension, delete it.
Upload the .htaccess file to the root directory of your website. This is the topmost folder of your website's file structure and contains your index file.
The .htaccess file now affects every other file in your website.
Updating Your Blog's Copyright Year
Copyright That Spans Several Years
A range of years next to your copyright symbol subtly reminds the visitor how long you've been in business or how long your website has been up. Use the script to update the last year of your range.
Copy and paste the following as your copyright notice's html code. Change 2002 to the year in which your site was established:
Copyright © 2002–
Your copyright year updates are now on autopilot. One less thing to worry about at 12:00:01 a.m. next Jan. 1.
We design and build custom mobile websites. For details, contact us.
# # #
Google Ads and Search Engine Optimization
- How to Get Details of Calls from Ads in Your Google Ads Campaigns
- How to Set Up a Google Ads Display Remarketing Campaign
- Why Some Google AdWords Campaigns Don't Work
- How to Be Found on the Web Through Search Engine Optimization
- 3 Easy Ways to Edit Your Documents
- 15 Tips on Interviewing an Expert for a Story
- Hyphen, En Dash, Em Dash
- One Space, Not Two, After a Period, Please
- How to Write Copy for Your Website
- Automatically Update the Copyright Year on Your Website
- How to Embed a PowerPoint Presentation in Your Website Using Google Drive
- How to Give Your Google Docs Document a Public URL
- How to Set Up Your First Website
- Open External Links in a New Tab
- How to Clear Cookies, Cache and History from Chrome on Android Phones
- How to Clear Cookies, Cache and Internet Browser History from iPhone, iPad or iPod Touch
- How to Clear Individual, Specific Cookies from Your iPhone, iPad, or iPod Touch
- How to Add a Clickable Phone link with HTML (Including WordPress)
- A Mobile Website: What It Is, Why You Need One