only allowing recent posts by using a 'where clause' when loading records

4 posts by 3 authors in: Forums > CMS Builder
Last Post: January 7, 2014   (RSS)

Hello,

              I would like to only include records that have been created in the past 45 days.  What can I add to the clause below to do that?

'where'       => 'date>=DATE(NOW())',

Jeff Saitz

By jenolan - January 6, 2014 - edited: January 6, 2014

'where'       => 'date>=' . strtotime("-45 day") . ',

If you meant for it to be a date yyyy-mm-dd type rather than unix time

'where'       => 'date>='. date('Y-m-d',strtotime("-45 day")) .',

mysql only version

'where'       => 'date>= DATE_SUB(NOW(), INTERVAL 30 DAY)',

---



Peace and Long Life

Thank you.  That worked perfectly.

Jeff Saitz