I have a date saved as a string similar to this tdate:"2016-11-26 2:23:11"in mongodb. I want to count all objects that have this date 2016-11-26. This is how I try to use php, but no luck.
date_authenticated has this format "Y-m-d H:i:s"so far I want to get all objects daythat should have this format"Y-m-d"
function count_auth($tdate) {
$collection = 'mycollection';
return $this->db->{$collection}->count(array('date_authenticated' => $tdate));
}
source
share