• Модуль: tasks
  • Путь к файлу: ~/bitrix/modules/tasks/lib/util/calendar.php
  • Класс: BitrixTasksUtilCalendar
  • Вызов: Calendar::getWorkHours
public function getWorkHours(DateTime $date)
{
	$hours = array();
	if ($this->isWeekend($date) || $this->isHoliday($date))
	{
		return $hours; // no work hours for $date
	}

	$year = 	$date->getYearGmt();
	$month = 	$date->getMonthGmt(true);
	$day = 		$date->getDayGmt();

	for ($i = 0; $i < count($this->workTime); $i++)
	{
		$time = $this->workTime[$i];

		array_push($hours, array(
			'startDate' => DateTime::createFromTimeStructGmt(array(
				'hours' => 		$time['start']['hours'],
				'minutes' => 	$time['start']['minutes'],
				'seconds' => 	0,
				'mon' => 		$month,
				'day' => 		$day,
				'year' => 		$year
			), true),
			'endDate' => DateTime::createFromTimeStructGmt(array(
				'hours' => 		$time['end']['hours'],
				'minutes' => 	$time['end']['minutes'],
				'seconds' => 	0,
				'mon' => 		$month,
				'day' => 		$day,
				'year' => 		$year
			), true)
		));
	}

	return $hours;
}