1. Home
  2. FAQ
  3. PHP FAQ
  4. Get Current Year

Get Current Year

How to Get the Current Year using PHP

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.

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.

Tags , ,