I have an array of objects. Each object includes a date value.
What's the best of filtering the array according to a specific date range, where the range is specified as startDate & endDate?
Update:
Thanks for your replies, I used this code in the end:
foreach ($myArray as $key => &$value)
{
$d = DateTime::createFromFormat(self::DATE_FORMAT, $value["orderDate"]);
if ($d->getTimestamp() < $startDateTime->getTimestamp() || $d->getTimestamp() > $endDateTime->getTimestamp())
{
unset($myArray[$key]);
}
}
ORDER BYkeywords..