Skip to content

Instantly share code, notes, and snippets.

@Pebblo
Last active March 31, 2016 21:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Pebblo/f4d151e4784c6aa67a3d to your computer and use it in GitHub Desktop.
Save Pebblo/f4d151e4784c6aa67a3d to your computer and use it in GitHub Desktop.
An example of how to pull an array of datetimes assigned to an event, resetting the $datetimes so that $datetime contains the next upcoming datetime for that event.
<?php
//Pull a list of upcoming datetimes from the event and reset the array to return the first (next upcoming)
EE_Registry::instance()->load_helper('Event_View');
$event = EEH_Event_View::get_event();
$datetimes = $event->datetimes_ordered($show_expired = FALSE, $show_deleted = FALSE);
$datetime = reset($datetimes);
//echo the day
$datetime->e_start_date('d');
//echo the month
$datetime->e_start_date('M');
//echo the year
$datetime->e_start_date('Y');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment