How to Add Year to Date in PHP?

By Hardik Savani November 5, 2023 Category : 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...

Tags :
Shares