PHP

Print

http://us1.php.net/manual/en/function.print.php

Print Year

Code
<?php echo date("Y"); ?>

or

<div>
&copy; <?php 
$copyYear = 2008; 
$curYear = date('Y'); 
echo $copyYear . (($copyYear != $curYear) ? '-' . $curYear : '');
?> Me, Inc.
</div>

If you use echo date you should set your server's timezone in php.ini. You can put it at the end of the file.

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = America/New_York

PHP Frameworks

273 reads • Last Modified: Thursday, June 30, 2016