subtract Days – How to Subtract Days to Date in PHP?

0
()

Subtract Days 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.

subtract Days to Date using PHP

Subtract Days to $current_date can be done in many ways. The following source code will Subtracts Days to Date.

Example 1: PHP Subtracts Days to Date

php_subtract_days_to_date.php

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

Result

2022-10-29

Free Live Chat for Any Issue

don’t miss : Php Add Year To Date

Read Also:  JavaScript Access PHP variables in jQuery

Example 2: PHP Subtracts Days to Current Date

php_subtract_days_to_current_date.php

<?php
  
    $latestDt = date('Y-m-d', strtotime(' - 3 days'));
  
    echo $latestDt;
  
?>

Result

2022-11-06

Download

I hope you get an idea about subtracts Days.
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.