I want to put a copyright notice in the footer of a web site, but I think it\'s incredibly tacky for the year to be outdated.
How would I make the year update automat
http://us2.php.net/date
echo date('Y');
If your server supports Short Tags, or you use PHP 5.4, you can use:
<?=date("Y")?>
Here's what I do:
<?php echo date("d-m-Y") ?>
below is a bit of explanation of what it does:
d = day
m = month
Y = year
Y will gives you four digit (e.g. 1990) and y for two digit (e.g. 90)
use a PHP date()
function.
and the format is just going to be Y. Capital Y is going to be a four digit year.
<?php echo date("Y"); ?>
BTW... there are a few proper ways how to display site copyright. Some people have tendency to make things redundant i.e.: Copyright © have both the same meaning. The important copyright parts are:
**Symbol, Year, Author/Owner and Rights statement.**
Using PHP + HTML:
<p id='copyright'>© <?php echo date("Y"); ?> Company Name All Rights Reserved</p>
or
<p id='copyright'>© <?php echo "2010-".date("Y"); ?> Company Name All Rights Reserved</p
<?php
$time_now=mktime(date('h')+5,date('i')+30,date('s'));
$dateTime = date('d_m_Y h:i:s A',$time_now);
echo $dateTime;
?>