PHP Date Time: Getting Current
PHP Date Time Tips - Part 1: If you want to display current date and/or time, you can try code like this:
<? $now = getdate(); ?>
It create array that contents information about current date time. To look what content of the array, you can try like this:
<? $now = getdate(); print_r($now); ?>
So, you can see:
Array ( [seconds] => 20
[minutes] => 56
[hours] => 15
[mday] => 20
[wday] => 4
[mon] => 3
[year] => 2008
[yday] => 79
[weekday] => Thursday
[month] => March
[0] => 1206053780 )
Thus, you can use like this:
<?
$now = getdate();
echo "current date is ".
$now['mday'] . " ".
$now['month']. " ".
$now['year'];
echo "<br />";
echo "current time is ".
$now['hours']. ":".
$now['minutes']. ":".
$now['seconds'];
?>
