public static function timeofprvmonth($inp = 0) { if ($inp == 0) { $inp = Fun::dateToday(); } $datetodaynum = date("d", $inp); //today date integer (1-31) $maxdays = date('t', $inp); //Max days in this month return $inp - $datetodaynum * (24 * 3600); }