public function getCreditMonthEnd($month, $day) { if ((int) $day == 1) { return date('Y-m-t 23:59:59', strtotime("{$month}")); } if ((int) $day == 0) { $day = date('d', time()); } $ymd = DateUtil::addMonth("{$month}-{$day}", 1, 'y-m-d'); return date('Y-m-d 23:59:59', strtotime('-1 day', strtotime($ymd))); }