hi,
hi, how can i get all future events?
i'm not in the calendar scope, so i try with this code:
$var = DataObject::get("CalendarDateTime", "StartDate > " . date("now"));
but it doesn't work...
thanks
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
hi,
hi, how can i get all future events?
i'm not in the calendar scope, so i try with this code:
$var = DataObject::get("CalendarDateTime", "StartDate > " . date("now"));
but it doesn't work...
thanks
never mind, just found out:
$now = date("Y-m-d");
$var = DataObject::get("CalendarDateTime", "StartDate > '$now'", "StartDate");
That's not the best way to do it because you'll only get CalendarEvent objects rather than announcements and recurring events as well. Use:
DataObject::get_one("Calendar")->upcomingEvents(5);
Where the first argument is the number of events to return. Also see Calendar::recentEvents();