How to Get Next Day, Month, Year From Date In Php

To get next day, month, year form given date in PHP; Through this tutorial, i am going to show you how to get next day, month, year from given date in PHP.

How to Get Next Day, Month, Year From Date In Php

  • How to Get Next Day From Given Date In Php?
  • How to Get Next Month From Given Date In Php?
  • How to Get Next Year From Given Date In Php?

How to Get Next Day From Given Date In Php?

Using the php date() and strtotime() function, you can get next day from date in php; let’s see the following example:

<?php
    $date = "2022-01-11";
    $newdate = date("Y-m-d",strtotime ( '+1 day' , strtotime ( $date ) )) ;
    echo $newdate;
?>

Output of the above code; is as follows:

2022-01-12

How to Get Next Month From Given Date In Php?

Using the php date() and strtotime() function, you can get next month from date in php; let’s see the following example:

<?php
    $date = "2022-01-11";
    $newdate = date("Y-m-d", strtotime ( '+1 month' , strtotime ( $date ) )) ;
    echo $newdate;
?>

Output of the above code; is as follows:

2022-02-11

How to Get Next Year From Given Date In Php?

Using the php date() and strtotime() function, you can get next year from date in php; let’s see the following example:

<?php
    $date = "2022-01-11";
    $newdate = date("Y-m-d",strtotime ( '+1 year' , strtotime ( $date ) )) ;
    echo $newdate;
?>

Output of the above code; is as follows:

2023-01-11

Recommended PHP Tutorials

Be First to Comment

Leave a Reply

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