PHP Questions Home

Categories

Arrays
Files
Forms
Functions
Images
MySQL
Numbers
Others
Strings
Website


PHP Functions

PHP Functions


More PHP

Top Questions
Ask a Question

How do I display todays date on my website?


Another common enquiry, and once people did this all the time with JavaScript, if you are running PHP then why not do it through one line of code in your script.

The function you are after is called date, which has loads of different parameters that will return different elements of the date. For a full list, be sure to check out the manpage on the www.php.net site.

However to the question in hand:

<?php
$today 
date('F j, Y');
echo 
"Todays date is: $today";
//Todays date is: Sep 18, 2007
?>



More website PHP Questions

How can I find out where a site visitor comes from?
How do I perform a 301 redirect with PHP?
How do I find a visitors IP address?
How do I keep my site menu in one file?
How do I make sure an include file exists before loading the page?