How to Get the Current Year using PHP
date() function is used for getting date. You can customize the output by passing the values to the function. For example, to get the current year pass “Y” to the function. This will show you the current date only.
Use below sample PHP program to print current year.
// PHP program to get the current year
echo "Current Year is :";
$year = date("Y");
This is also useful for the printing the copyright statement with the current year at the footer of your website. For example add below state to your php script footer file.
Copyright © <?php echo date("Y"); ?> example.com. All Rights Reserved.