Looking for somewhere to host your site? Browse our PHP web hosts section!

Home > Code Snippets > Display date and time with PHP

Display date and time with PHP

Description

Quick one-liner to output the current server date and time on a page.

The code


<?php


/**
 * Just add this in your page where you
 * want the date/time to appear
 *
 * For more configuration options look
 * in the PHP manual at http://uk2.php.net/date
 */

// Displays in the format Saturday, November 22, 2003 11.38
echo date("l, F d, Y h:i" ,time());

?>

Get the code

Download the file to your computer: Click here to get the file