public static function getNextOccasionDate($occasions, $dateFormat = 'YmdHis')
    {
        if (!is_array($occasions) || empty($occasions)) {
            return false;
        }

        $startDates = array();
        foreach ($occasions as $occasion) {
            //Skip if event has ended
            if (time() > strtotime($occasion->end_date) || !isset($occasion->start_date) || !isset($occasion->end_date)) {
                continue;
            }

            $startDates[] = strtotime($occasion->start_date);
        }

        return date($dateFormat, self::getClosest(time(), $startDates));
    }
public static function getNextOccasionDate($occasions, $dateFormat = 'YmdHis')
    {
        if (!is_array($occasions) || empty($occasions)) {
            return false;
        }

        $startDates = array();
        foreach ($occasions as $occasion) {
            //Skip if event has ended
            if (time() > strtotime($occasion->end_date) || !isset($occasion->start_date) || !isset($occasion->end_date)) {
                continue;
            }

            $startDates[] = strtotime($occasion->start_date);
        }

        return date($dateFormat, self::getClosest(time(), $startDates));
    }
public static function getNextOccasionDate ( $ occasions , $ dateFormat = 'YmdHis' ) { if ( ! is_array ( $ occasions ) || empty ( $ occasions ) ) { return false ; } $ startDates = array ( ) ; foreach ( $ occasions as $ occasion ) { //Skip if event has ended if ( time ( ) > strtotime ( $ occasion -> end_date ) || ! isset ( $ occasion -> start_date ) || ! isset ( $ occasion -> end_date ) ) { continue ; } $ startDates [ ] = strtotime ( $ occasion -> start_date ) ; } return date ( $ dateFormat , self :: getClosest ( time ( ) , $ startDates ) ) ; }
Get next event occasion date in time
@param  array  $occasions  All occasions of an event
@param  string $dateFormat event start date
@return string/boolean
Get next event occasion date in time