you need to calculate the number of days from the current date to the 27th day of each month in PHP. In the code below, it correctly calculates the current month, but if the current date is 28, it should be calculated for the next month.
$year = date("y"); $month = date("m"); $day = '27'; $current_date = new DateTime(date('Ym-d'), new DateTimeZone('Asia/Dhaka')); $end_date = new DateTime("$year-$month-$day", new DateTimeZone('Asia/Dhaka')); $interval = $current_date->diff($end_date); echo $interval->format('%a day(s)');
source share