add months to date – How to Add Months to Date in PHP?

Add Months to Date in PHP and display it. The PHP date function is used to format a date. here we can learn to main 2 Examples.

add months to date using PHP

Adding Months to $current_date can be done in many ways. The following source code will added months to dates.

Example 1: PHP Added Months to Dates

php_add_months_to_date.php

<?php
  
    $myJoinDt = "2022-11-01";
    $latestDt = date('Y-m-d', strtotime($myJoinDt. ' + 3 months'));
  
    echo $latestDt;
  
?>

Result

2022-02-01

don’t miss : add days to date

Free Live Chat for Any Issue

Example 2: PHP Add Months to Current Date

php_add_months_to_current_date.php

<?php
  
    $latestDt = date('Y-m-d', strtotime(' + 4 months'));
  
    echo $latestDt;
  
?>

Result

2022-03-01

I hope you get an idea about add months to date.
I would like to have feedback on my infinityknow.com.
Your valuable feedback, question, or comments about this article are always welcome.
If you enjoyed and liked this post, donโ€™t forget to share.

Rate this post