I need to get an array with days missing from a month.
Get year and month: to Between:
$dateS //have the current given date to make the filter
$year = mb_substr($dateS, 0, 4);
$month = mb_substr($dateS, 5, 7);
$tday = cal_days_in_month(CAL_GREGORIAN, (int)$month, (int)$year);
$cmonthS = $year."-".$month."-01 00:00:00";
$cmonthE = $year."-".$month."-".$tday." 23:59:59";
I am getting the array with this statement:
$stmtpre = "SELECT days FROM registry WHERE days BETWEEN '2016-12-01 00:00:00' AND '2016-12-31 00:00:00';";
All data have the current format as date time in MySQL
:
XXXX-XX-XX 00:00:00
But it returns the current day, and I need to get in PHP
the missing days.
Does anyone know how can i do it?