/** * Given the start date, end date and meeting day of the week for this class, * this will return an array of all the meeting days * @return QDateTime[] */ public function GetClassMeetingDays() { // Figure out the first real start date $dttStartDate = new QDateTime($this->DateStart); if ($dttStartDate->PhpDate('w') < $this->intMeetingDay) { $dttStartDate->Day += $this->intMeetingDay - $dttStartDate->PhpDate('w'); } else { if ($dttStartDate->PhpDate('w') > $this->intMeetingDay) { $dttStartDate->Day += 7 - ($dttStartDate->PhpDate('w') - $this->intMeetingDay); } } // Array to Return $dttArrayToReturn = array(); while ($dttStartDate->IsEarlierOrEqualTo($this->DateEnd)) { $dttToAdd = new QDateTime($dttStartDate); $dttArrayToReturn[] = $dttToAdd; $dttStartDate->Day += 7; } return $dttArrayToReturn; }