$day = 1; //set timestamp to the start of the month $startDate = $startStamp; $prevMonth = mktime(0, 0, 0, $month-1, $day, $year); $nextMonth = mktime(0, 0, 0, $month+1, $day, $year); $totalDist = 0; $totalVel = 0; $averageVel = 0; $totalTime = array(); $days = daysInMonth($month, $year); for ($i=0; $i<$days; $i++) { $dayStamp = mktime(0, 0, 0, $month, $day+$i, $year); $ss = $manager->getDaysSessions($uId, $dayStamp); $sessions = DcUnitConverter::convertSessions($ss, $distUnit, $timeUnit); $content = ""; $dayDist = 0; $numSessions = count($sessions); for ($j=0; $j<$numSessions; $j++) { $session = $sessions[$j]; $ts = strtotime($session->startTime); $dateFrmtd = date("g:ia", $ts); $sTime = $session->startTime; $eTime = $session->endTime; $diff = getTimeDifference($sTime, $eTime); $totalTime['hours'] += $diff['hours']; $totalTime['minutes'] += $diff['minutes']; $totalTime['seconds'] += $diff['seconds'];