Get Calendar Info for a specific date (Holidays or A/B Week)

@param int $intTime Timestamp of day
@return str
515233
public static function getInfoForDay($intTime) {
		static::loadData();

		//find school year
		foreach (static::$arrDBCalendar as $id => $year) {
			if($intTime > $year['start'] && $intTime < $year['end']) {
				$schoolYearId = $id;
			}
		}

		static::generateFullCalendar($schoolYearId);
		$info = static::$arrFullCalendar[$schoolYearId][date('Y-m-d',$intTime)];

		//Holidays
		if(is_array($info)){
			\System::loadLanguageFile('tl_schoolyear_holiday');
			return array(
				'type' 	=> array(
					'name'	=> $info['type'],
					'str' 	=> &$GLOBALS['TL_LANG']['tl_schoolyear_holiday']['type'][$info['type']]
				),
				'title'	=> $info['name'],
			);
		}
		//Normal school day
		elseif($info) {
			return array(
				'type'	=> array(
					'name'	=> 'lessons',
					'str'	=> 'Unterricht'
				),
				'title'	=> $info
			);
		}
		return false;
	}
868589
protected function getTstamp($time = null)
    {
        $time = !is_null($time) ? strtotime($time) : time();
        $month = date("M", $time);
        $day = substr("  " . date("j", $time), -2);
        $hhmmss = date("H:i:s", $time);
        return $month . " " . $day . " " . $hhmmss;
    }
126854
public static int getWeek(Date date) {
        CALENDAR.setTime(date);
        return CALENDAR.get(Calendar.DAY_OF_WEEK);
    }
1205368
protected function getDateTime($dateTime)
    {
        if ($dateTime instanceof \DateTime) {
            return $dateTime;
        }

        if ((is_string($dateTime) && (int) $dateTime > 0) || is_numeric($dateTime)) {
            return (new \DateTime())->setTimestamp($dateTime);

        }

        throw new \common_Exception(__('A date has to be a Datetime or timestamp'));
    }
247102
private function getClosestDateAfter(\DateTime $date)
    {
        $tmpDate = clone $date;
        $dayOfWeek = (int) $tmpDate->format('N');
        $time = Time::fromDate($tmpDate);

        if (!$this->holidays->isHoliday($tmpDate) && null !== $day = $this->getDay($dayOfWeek)) {
            if (null !== $closestTime = $day->getClosestOpeningTimeAfter($time, $tmpDate)) {
                $tmpDate->setTime($closestTime->getHours(), $closestTime->getMinutes(), $closestTime->getSeconds());

                return $tmpDate;
            }
        }

        $tmpDate = $this->getDateAfter($tmpDate);

        while ($this->holidays->isHoliday($tmpDate)) {
            $tmpDate = $this->getDateAfter($tmpDate);
        }

        $closestDay = $this->getClosestDayBefore((int) $tmpDate->format('N'));
        $closingTime = $closestDay->getOpeningTime($tmpDate);
        $tmpDate->setTime($closingTime->getHours(), $closingTime->getMinutes(), $closingTime->getSeconds());

        return $tmpDate;
    }
1313308
public static function get_DateTime( &$dateTime )
    {
        if( $dateTime instanceof DateTime ) {
            return $dateTime;
        }
        return !is_null($dateTime)
            ? new DateTime( $dateTime )
            : null
            ;
    }
623209
public function dateString(string $time): string
    {
        return date($this->dateFormat, ctype_digit($time) ? $time : strtotime($time));
    }
915934
public function dayOfWeek()
    {
        $dateString = sprintf(
            '%04d-%02d-%02d',
            $this->month->getYear()->value(),
            $this->month->value(),
            $this->day
        );

        $datetime = new \DateTime($dateString);

        return (int) $datetime->format('N');
    }
484014
public function getDate(\DateTimeInterface $dateTime)
    {
        $date = new Date($dateTime);
        $this->loadDay($date);

        return $date;
    }
860711
public function getWeekday($timestamp = false)
    {
        if (!$timestamp) {
            $timestamp = $this->dateTime->getTimestamp();
        }

        return date('w', $timestamp);
    }
267682
protected function getDateFormatter($dateFormat, $timeFormat, $calendar)
    {
        $datetype = isset($dateFormat) ? $this->getFormat($dateFormat) : null;
        $timetype = isset($timeFormat) ? $this->getFormat($timeFormat) : null;

        $calendarConst = $calendar === 'traditional' ? \IntlDateFormatter::TRADITIONAL : \IntlDateFormatter::GREGORIAN;
        
        $pattern = $this->getDateTimePattern(
            isset($datetype) ? $datetype : $dateFormat,
            isset($timetype) ? $timetype : $timeFormat,
            $calendarConst
        );
        
        return new \IntlDateFormatter(\Locale::getDefault(), $datetype, $timetype, null, $calendarConst, $pattern);
    }
369461
public function day(DateTimeInterface $dateTime, string $dateFormat = 'Y-m-d, H:i'): string
	{
		if($dateTime->format('Y-m-d') === date('Y-m-d'))
		{
			return $this->i18n->get('humanizer.today');
		}
		elseif($dateTime->format('Y-m-d') === date('Y-m-d', time() - (60 * 60 * 24)))
		{
			return $this->i18n->get('humanizer.yesterday');
		}
		elseif($dateTime->format('Y-m-d') === date('Y-m-d', time() + (60 * 60 * 24)))
		{
			return $this->i18n->get('humanizer.tomorrow');
		}
		else
		{
			return $dateTime->format($dateFormat);
		}
	}
115498
protected function & getIntlDatetimeFormatter ($langAndLocale = NULL, $dateType = NULL, $timeType = NULL, $timeZone = NULL, $calendar = NULL) {
		$key = implode('_', [
			'datetime',
			serialize(func_get_args())
		]);
		if (!isset($this->intlFormatters[$key])) {
			$this->intlFormatters[$key] = \datefmt_create(
				$this->langAndLocale, $dateType, $timeType, $timeZone, $calendar
			);
		}
		return $this->intlFormatters[$key];
	}
743892
public function getDateTimeForWeekView()
    {
        $startTime = new \DateTime('2004-06-28 '.$this->getStartTime().':00');

        while ($startTime->format('N') < $this->getDayOfWeekNumber())
        {
            $startTime->add(new \DateInterval('P1D'));
        }

        return $startTime;
    }
161496
public static function get_fields_from_time($time) {
        $calendartype = \core_calendar\type_factory::get_calendar_instance();
        $wrongfields = $calendartype->timestamp_to_date_array($time);
        return array('day' => $wrongfields['mday'],
                'month' => $wrongfields['mon'], 'year' => $wrongfields['year'],
                'hour' => $wrongfields['hours'], 'minute' => $wrongfields['minutes']);
    }
298787
public static function getDateTime($datetime = null)
    {
        if ($datetime instanceof \DateTime) {
            return clone $datetime;
        }
        if ($datetime instanceof \DateTimeImmutable) {
            return new \DateTime($datetime->format(\DateTime::ATOM));
        }
        if (\is_string($datetime)) {
            if (\is_numeric($datetime)) {
                /*
                    check if datetime is an int of the the form YYYYMMDD or YYYYMMDDHHMMSS
                    Debug::_log('datetime', $datetime)
                */
                $isTs = !preg_match('/^(19|20)\d{2}(0[1-9]|1[0-2])[0-3][0-9](([01]\d|2[0-3])\d[0-5]\d[0-5]\d)?$/', $datetime);
                if ($isTs) {
                    $datetime = '@'.$datetime;
                }
            }
            Debug::_log('datetime', $datetime);
            return new \DateTime($datetime);
        }
        if (\is_int($datetime) || \is_float($datetime)) {
            $dateTime = new \DateTime();
            $dateTime->setTimestamp($datetime);
            return $dateTime;
        }
        return new \DateTime();
    }
693233
public static function toStamp($time = null, $currentIsDefault = true): int
    {
        if ($time instanceof DateTime) {
            return $time->format('U');
        }

        if (null !== $time) {
            $time = is_numeric($time) ? (int)$time : strtotime($time);
        }

        if (!$time) {
            $time = $currentIsDefault ? time() : 0;
        }

        return $time;
    }