I'm assuming you have a column in the database called created which
cake will fill in automatically
If you check the book it gives you an example here
http://book.cakephp.org/#!/view/1017/Retrieving-Your-Data under the
complex find conditions
$conditions = array( "Post.created >" => date('Y-m-d', strtotime("-1
weeks")));
$this->Model->find('all',array('conditions'=>$conditions));
On Mar 10, 4:22 pm, DigitalDude <[email protected]> wrote:
> Hey,
>
> I just can't figure this out, but I need a find for fetching all
> records that were created "this week" or "last week".
>
> To clarify this, I'm running a cronjob every sunday and create some
> reports for each user. I need to find every record that was created
> within the ending week. When the cronjob is running sunday evening, it
> should fetch all data from the week from monday till the sunday the
> cron job is running.
>
> Is there any chance doing this in a normal Cake find? I think with an
> SQL statement this one is not so difficult but I really hate having
> straight SQL statements within my cake applications.
>
> So if anyone would have a simple example for this, I would be ver
> happy!
>
> Regards,
>
> DD
--
Our newest site for the community: CakePHP Video Tutorials
http://tv.cakephp.org
Check out the new CakePHP Questions site http://ask.cakephp.org and help others
with their CakePHP related questions.
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at
http://groups.google.com/group/cake-php