I spent a good amount of time last night scouring the internet trying to find a solution to finding all of the records created from the last hour in the MySQL database. The one answer I found which is posted everywhere doesn't even work..
This is what I've come up with based on what I found online and thought might work:
$recentUploads = $this->Upload->find('all', array(
'conditions' => array('Upload.created LIKE' => date('Y-m-d H:i:s', strtotime('-1 hour')))
));
But still no luck at all. Any thoughts?
You want records where the timestamp is greater than or equal to the time 1 hour ago:
$recentUploads = $this->Upload->find(
'all',
array(
'conditions' => array(
'Upload.created >=' => date('Y-m-d H:i:s', strtotime('-1 hour'))
)
)
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With