Here's the JavaScript. Copy and paste it wherever you want the current year to appear:
<script language="javascript" type="text/javascript"> var today = new Date() var year = today.getFullYear() document.write(year) </script>
And here's the php script:
<?php echo date("Y"); ?>
php with start year:
&copy; 2008-<?php echo date("Y") ?>
Start date with error protection:
<?php function auto_copyright($year = 'auto'){ if(intval($year) == 'auto'){ $year = date('Y'); } if(intval($year) == date('Y')){ echo intval($year); } if(intval($year) < date('Y')){ echo intval($year) . ' - ' . date('Y'); } if(intval($year) > date('Y')){ echo date('Y'); } } ?>
here's how to use it
<?php auto_copyright(); // 2011?> or <?php auto_copyright('2010'); // 2010 - 2011 ?>