1. Home
  2. Computing & Technology
  3. PHP / MySQL

Today's Date using PHP
Display the Current Date on Your Website

By , About.com Guide

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.
More PHP / MySQL Quick Tips
Explore PHP / MySQL
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. Step By Steps
  5. Display Current Date - PHP HTML Current Date

©2009 About.com, a part of The New York Times Company.

All rights reserved.