I have a series of news items saved in my database, each with a startDate and endDate. I'm trying to figure out how to write the filter condition to get all current news item (i.e., those where startDate <= Now and endDate > Now. I've looked around for an example to emulate, but without success.
Here's what I have so far...
class HomePage_Controller extends Page_Controller {
function HomePageNews() {
return DataObject::get('NewsItem', [date filter goes here], 'ID DESC');
}
}
Any assistance on writing the date filter would be most appreciated. Thanks.
Cheers,
Laurie