Auto Update Website Footer Date with JavaScript

The Problem: Every year the footer of your personal or company website will need to be updated. It would be a waste of your time and you would risk breaking your code if you needed to update every single webpage to type “2020” in the footer of the page. This should be automated.

The Solution: Use JavaScript to get the date, set it as a variable, and display the result in the footer of the page.

<script type="text/javascript"> //Declares the JavaScript
   
   let d = new Date(); // Creates a variable and calls Date Object
   
   document.write(d.getFullYear()); // Calls getFullYear method on variable d(new Date() Object) and displays year

</script> // Closing bracket

The code above can be copied and pasted into the footer of your website pages. If you have a couple of static pages, it isn’t a big deal to edit each page. In my case, I added the code to the footer.php file for my custom WordPress theme. WordPress automatically appends the footer.php to every new post or page that I create. Now a user will always see a dynamically generated date at the bottom of the page.

Food Inventory

The Problem: Opening and digging through a smaller chest freezer. Also, need a way to keep track of food inventory for quarantine.
The Solution: A database accessible from my phone to add, remove, update, or delete items. At the grocery I can see what I have or don’t have at home.

Total Records Found: 93, showing 20 per page
CountItemBrandOuncesCategoryLocationUpdated
3 Beef Broth Less Sodium College Inn 15 Other Pantry June 22, 2020
2 Beef Broth Campells 11 Other Pantry June 22, 2020
1 Spam Hormel 12 Meat Pantry June 22, 2020
2 Tomato Sauce Cento 15 Other Pantry June 22, 2020
2 Pineapple Crushed Generic 20 Fruit Pantry June 22, 2020
1 Salsa Mild Herrs 16 Dip Pantry June 22, 2020
1 Chicken Breast (Canned) Hormel 10 Meat Pantry June 22, 2020
1 Mango Peach Salsa Archer Farms 16 Dip Pantry June 22, 2020
1 Roasted Salsa Verde Archer Farms 16 Dip Pantry June 22, 2020
2 Pink Salmon Bumble Bee 5 Fish Pantry June 22, 2020
3 Tuna Starkist 5 Fish Pantry June 22, 2020
1 Lemon Fruit Pantry June 22, 2020
2 Banana Fruit Pantry June 20, 2020

OUT OF STOCK:

Total Records Found: 30, showing 20 per page
CountItemBrandOuncesCategoryLocationUpdated


I customized the WordPress plugin “Participants Database” to Create, Read, Update, and Delete food items. Anyone can add items but a WordPress login is required to update or delete food items.