Answers for "php date now -1 month day until last day"

PHP
0

in date function + 1 month and - 1 day in php

echo Date("Y-m-d", strtotime("2013-01-01 +1 Month -1 Day"));// 2013-01-31

echo Date("Y-m-d", strtotime("2013-01-31 +1 Month -3 Day")); // 2013-02-28

echo Date("Y-m-d", strtotime("2013-01-31 +2 Month")); // 2013-03-31

echo Date("Y-m-d", strtotime("2013-01-31 +3 Month -1 Day")); // 2013-04-30

echo Date("Y-m-d", strtotime("2013-12-31 -1 Month -1 Day")); // 2013-11-30

echo Date("Y-m-d", strtotime("2013-12-31 -2 Month")); // 2013-10-31

echo Date("Y-m-d", strtotime("2013-12-31 -3 Month")); // 2013-10-01

echo Date("Y-m-d", strtotime("2013-12-31 -3 Month -1 Day")); // 2013-09-30
Posted by: Guest on October-13-2020
0

getting last day of next month in php

$lastDateOfNextMonth =strtotime('last day of next month') ;

$lastDay = date('d/m/Y', $lastDateOfNextMonth);

 

print_r($lastDay);
Posted by: Guest on November-28-2020

Browse Popular Code Answers by Language