format('Y'); $currentMonth = $today->format('m'); $currentDate = $today->format('d'); if ($currentDate === 1) { return new DateTime("$currentYear-$currentMonth-01"); // Today is the 1st of the month. } elseif ($currentDate <= 20) { return new DateTime("$currentYear-$currentMonth-15"); // Return the 15th of the current month. } else { $nextMonth = $today->modify('first day of next month'); // Advance to the first day of the next month. return $nextMonth; } } ?>