Dynamic Copyright Date

Ok, we’ve all got the standard copyright notice at the bottom of our web pages, something like © 2009.

© 2009

But let’s be honest, nothing looks worse than a copyright statement when the year is out of date! It gives the impression that you don’t care.

You can easily prevent this by using the php date() function:

&copy; <?php echo date('Y'); ?>

Really simple and one less thing to think about. Leave and forget :)

Feed IconFollow me on Twitter





5 Responses to “Dynamic Copyright Date”

  1. &copy; 
    <?php ini_set('date.timezone', 'Europe/London');
    $startYear = '2009'; 
    $thisYear = date('Y'); 
    if($startYear == $thisYear) { 
        echo $startYear; }
    else { 
        echo $startYear.' &ndash '.$thisYear; } ?> 
    &nbsp;YOUR NAME

    Is the one I use. Slightly more advanced, but lets you have the whole 2008 – 2009 thing, accurate to time-zone :)

  2. Your tag doesn’t work :(

  3. Oh bugger, send me your code and I’ll amend your posts :)
    Meanwhile, I’ll have a look at the comment system.

    Cheers Scott :)

  4. The best way at the moment to post code in a comment is to use the pre tag with a lang attribute of either php, css, javascript or html4strict like this:

    <body>
  5.  Fair enough lol. Don't know why it's being spazzy!

    Cheers for the amendment.

Leave a Comment







XHTML: You can use the following tags in your comments: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">