I have a database table storing announcements. The table has a datetime column called "created", and I'd like to only show announcements that were entered within the last 7 days (in my chronoconnectivity connection). It seems that the where clause just filters everything out. Anyone know how I'm supposed to do this?
I tried the following code (in the Model conditions section):
I have the debug section enabled, and the where clause of my query shows up like this:
"WHERE announcements.created between 1400636096 and 1400722496"
I tried the following code (in the Model conditions section):
<?php
$oneWeekAgo = strtotime("-1 week");
$now = strtotime("now");
return array(":announcements.created between $oneWeekAgo and $now");
?>
I have the debug section enabled, and the where clause of my query shows up like this:
"WHERE announcements.created between 1400636096 and 1400722496"
You will need to format the date info you enter to be in the same db date format:
Regards,
Max
$oneWeekAgo = date("Y-m-d H:i:s", strtotime("-1 week"));
$now = date("Y-m-d H:i:s", strtotime("now"));
Regards,
Max
This topic is locked and no more replies can be posted.