/** * Generates whole week from a specific date * @param string * @return array */ public static function getWeek($date) { $week = array(); $allmonths = array(1 => 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); $tempDate = new ExpressiveDate($date); $startWeek = $tempDate->startOfWeek()->getDate(); $currentDay = new ExpressiveDate($startWeek); for ($i = 0; $i < 7; $i++) { $tempday = array(); $tempday['day'] = $currentDay->getDay(); $tempday['year'] = $currentDay->getYear(); $tempday['dayofweek'] = $currentDay->getDayOfWeek(); $tempday['month'] = $allmonths[(int) $currentDay->getMonth()]; $tempday['class'] = 'calendar-day-' . $currentDay->getDate(); $tempday['date'] = $currentDay->getDate(); $currentDay = $currentDay->addOneDay(); $week[] = $tempday; } return $week; }