How to Add Year to Date in PHP?

In this blog, We will understand about adding year to date in PHP.  This will be very easy as it is used in many big projects and reporting sections. 

Let's start with examples,


Add Years to Date PHP


<?php

  

    $date = "2023-06-02";

    $newDate = date('Y-m-d', strtotime($date. ' + 5 years'));

  

    echo $newDate;

?>


Output:


2028-06-02


Add Year to Current Date PHP


<?php

  

    $newDate = date('Y-m-d', strtotime(' + 5 years'));

    echo $newDate;

  

?>


Output:


2028-06-02


I hope you understood this. If you have any doubts please let us know in comments.