PHP Script to add or subtract days, months, years to a Date!

Here is another Interesting PHP script which you can use it in your project. A PHP script to add or subtract days, months and years to a date.



Adding days or months or year to a date in PHP is a piece of cake if you are an experienced PHP person. Just see the snippet below:

Easy right? But I have elaborated the above snippet to a useful PHP script along with HTML and Ajax. You can modify and use it in your projects if you wish to.

HTML and jQuery part (Front end – index.php):

Read the in-line comments in the above program to understand the script.


PHP date calculation script: (Backend – caldate.php):

Above Frontend and Backend script can be written in a single page, but I have implemented Ajax to not to refresh the page after every click of the ‘Find New Date’ button.

You can see the demo here:



And you can download the script from below as a zip file:



About the Author


Software Engineer, Blogger etc., Visit my Youtube channel - <a href="">Click Here</a>

Leave a Reply

Your email address will not be published. Required fields are marked *