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

By ross - January 7, 2014

Hi Larry

Thanks for jumping in to help on this one! Looks like that's exactly what Jeff was looking for :)

-----------------------------------------------------------
Cheers,
Ross Fairbairn - Consulting
consulting@interactivetools.com

Hire me! Save time by getting our experts to help with your project.
Template changes, advanced features, full integration, whatever you
need. Whether you need one hour or fifty, get it done fast with
Priority Consulting: http://www.interactivetools.com/consulting/