1. Technology
You can opt-out at any time. Please refer to our privacy policy for contact information.

Today's Date using PHP

Display the Current Date on Your Website


Young businessman sitting on couch and working on laptop
Neustockimages/E+/Getty Images
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.
 <? print(Date("l F d, Y")); ?> 
Here is how it works:

  1. The scripts starts by opening up the PHP code with the <? symbols.

  2. Next, it uses the print function to send the date it is about to generate to the browser.

  3. The date function is then used to create today's date.

  4. Finally, the PHP script is closed using the ?> symbols.
Related Video
Using PHP With HTML
Basic PHP Syntax
See More About
  1. About.com
  2. Technology
  3. PHP / MySQL
  4. Step By Steps
  5. Display today's date on your website

©2014 About.com. All rights reserved.