WEB TUTORIALS
PRACTICE EXAMPLES
HTML REFERENCES
CSS REFERENCES
PHP REFERENCES
Advertisements

How to Get the Current Year using PHP

Topic: JavaScript / jQueryPrev|Next

Answer: Use the PHP date() Function

You can simply use the PHP date() function to get the current year.

The following example code will be very useful if you want to put a copyright notice in a website footer without worrying about changing it every year.

  • <p>Copyright &copy; 
  •     <?php echo date("Y"); ?> 
  • MyWebsite. All Rights Reserved.</p>

Related FAQ

Here are some more FAQ related to this topic:

Advertisements

Your Feedback:

We would love to hear from you, please drop us a line.