How to Add Year to Date in PHP?
Here, i will show you how to add year to date in php. i explained simply about how to add 5 years to current date in php. we will help you to give example of php add year to date. we will help you to give example of php add 1 year to current date.
I will give you very simple example how to add year to date in PHP. so let's see both example with output:
Example 1: PHP Add Year to Date
index.php
<?php
$date = "2022-02-01";
$newDate = date('Y-m-d', strtotime($date. ' + 5 years'));
echo $newDate;
?>
Output:
2027-02-01
Example 2: PHP Add Year to Current Date
index.php
<?php
$newDate = date('Y-m-d', strtotime(' + 5 years'));
echo $newDate;
?>
Output:
2026-03-01
i hope it can help you...
Hardik Savani
I'm a full-stack developer, entrepreneur and owner of ItSolutionstuff.com. I live in India and I love to write tutorials and tips that can help to other artisan. I am a big fan of PHP, Laravel, Angular, Vue, Node, Javascript, JQuery, Codeigniter and Bootstrap from the early stage. I believe in Hardworking and Consistency.
We are Recommending you
- How to Add Days to Date in PHP?
- PHP - How to Get File Name and Extension form URL?
- How to Find Number from String in PHP?
- How to Get HTML Tag Value in PHP?
- PHP Explode Every Character into Array Example
- PHP Copy File from One Folder to Another Example
- PHP Remove Directory and Files in Directory Example
- How to Check If a String Contains HTML Tags in PHP?
- How to Remove Null Values from Array in PHP?
- How to Merge Two Array with Same Keys without Loop in PHP?