[eluser]Stenson[/eluser]
Is it possible to have the strtotime within a Model?
What I want to do is select all the timestamps within the database which are below the value of 1209600 (2 Weeks in integer). I just want to find the number of rows in the table that have been added within the last two weeks.
for example a function similar to this
Code:
function myFunction() {
$currentTime = time();
$time = strtotime($currentTime);
$twoweeks = $time - 1209600;
$this->db->where(strtotime('myDate <'), $time);
$query = $this->db->get('tablename');
if($query->num_rows > 0 ) {
$numOfRows = $query->num_rows();
return $numOfRows;
}
}
Even a rough idea on how to do it within the traditional SELECT * FROM way would help me.
I hope someone can guide me in the right direction.
Thanks
CI Community