$date1 = date("Y-m-d", strtotime("first day of last month"));
echo $datestart = date('Y-m-d', strtotime("+4 days", strtotime($date1))); // date start
$date2 = date("Y-m-d", strtotime("first day of this month"));
echo $dateend = date('Y-m-d', strtotime("+4 days", strtotime($date2))); // date end
Output:
2020-09-05
2020-10-05
**************************************************************************************
$from_date = date("Y-m-d", strtotime('2020-09-05'));
$today_date = date('2020-10-01'); //date('Y-m-d');
$date1 = new DateTime($from_date);
$date2 = new DateTime($today_date);
$diff = $date1->diff($date2);
echo $diff->days;
Output: 26
**************************************************************************************
Write PHP code and execute PHP script with online editor
Click here http://www.writephponline.com
No comments:
Post a Comment