Q:

How to Get the Current Year using PHP

0

How to Get the Current Year using PHP

All Answers

need an explanation for this answer? contact us directly to get an explanation for this 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 © 
    <?php echo date("Y"); ?> 
MyWebsite. All Rights Reserved.</p>

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

PHP  and MySQL Frequently Asked Questions

This question belongs to these collections

Similar questions


need a help?


find thousands of online teachers now
How to Convert a Date from yyyy-mm-dd to dd-mm-yyy... >>
<< How to Strip All Spaces Out of a String in PHP...