Fancy displaying the current year and avoid having to update your copyright every year? It's really simple.
<?php echo date("Y"); ?>
<?= date('Y') ?> (This requires PHP 5.4+)
© <?php echo date("Y"); ?> - All rights reserved.
strftime("%Y");
© <?php $copyYear = 2013; $curYear = date('Y'); echo $copyYear . (($copyYear != $curYear) ? '-' . $curYear : ''); ?> My Company.
View the JavaScript method
- We recommended the PHP method over the JavaScript method.
This article applies to the following:
- PHP: Hypertext Preprocessor - Server-side HTML embedded scripting language. It provides web developers with a full suite of tools for building dynamic websites: native APIs to Apache.
- JavaScript Kit- Your comprehensive JavaScript - JavaScript (JS) is a dynamic computer programming language. It is most commonly used as part of web browsers, whose implementations allow client-side
Article incorrect or outdated? Do let us know →
Updated 18/01/14 @ 08:55 PM
Daniel D, Editor