The current date can be displayed using the single line of code below. This will only work on pages where PHP is enabled. This means that it will display a date on pages that end in .php (you can name your HTML page to have a .php extension) or other extensions setup
on your server to run PHP.
Here is how it works:
<? print(Date("l F d, Y")); ?>
- The scripts starts by opening up the PHP code with the <? symbols.
- Next, it uses the print function to send the date it is about to generate to the browser.
- The date function is then used to create today's date.
- Finally, the PHP script is closed using the ?> symbols.