Here's the JavaScript. Copy and paste it wherever you want the current year to appear:

  1. <script language="javascript" type="text/javascript">
  2. var today = new Date()
  3. var year = today.getFullYear()
  4. document.write(year)
  5. </script>

And here's the php script:

  1. <?php echo date("Y"); ?>

php with start year:

  1. &amp;copy; 2008-<?php echo date("Y") ?>

Start date with error protection:

  1. <?php
  2. function auto_copyright($year = 'auto'){
  3.  
  4. if(intval($year) == 'auto'){
  5. $year = date('Y');
  6. }
  7.  
  8. if(intval($year) == date('Y')){
  9. echo intval($year);
  10. }
  11.  
  12. if(intval($year) < date('Y')){
  13. echo intval($year) . ' - ' . date('Y');
  14. }
  15.  
  16. if(intval($year) > date('Y')){
  17. echo date('Y');
  18. }
  19.  
  20. } ?>

here's how to use it

  1. <?php auto_copyright(); // 2011?>
  2. or
  3. <?php auto_copyright('2010'); // 2010 - 2011 ?>