@param \DateTime $date
@param string    $state

@return Holiday
771643
public function getHolidayByDate(\DateTime $date, $state = null)
    {
        $day = $date->format(self::DATE_FORMAT);

        $holidays = $this->getHolidaysByYear(intval($date->format('Y')));

        if (isset($holidays[$day])) {
            $holiday = $this->createModelFromData($holidays[$day], $date);

            if (!$this->hasState($holiday, $state)) {
                $holiday = null;
            }

            return $holiday;
        }

        return null;
    }
417349
public function toDate($date, $dateFormat)
    {
        $dateTime = DateTime::createFromFormat($dateFormat, $date);

        return $dateTime->format(self::YMDH);
    }
78468
private function getNoWorkDaysWithinSingleYear(DateTime $firstDay, DateTime $lastDay, string $region, int $year, array $noWork): HolidayList
    {
        $holidays = [];
        $holidays[] = $this->holidayCalculator->calculateHolidaysForYear($year, $region, $firstDay->getTimezone());
        $temporaryHolidayCalculator = new HolidayCalculator(new WeekdayInitializer());
        foreach ($noWork as $noWorkDays) {
            $holidays[] = $temporaryHolidayCalculator->calculateHolidaysForYear($year, $noWorkDays->getId(), $firstDay->getTimezone());
        }

        $holidayList = $this->mergeHolidayLists($holidays);
        $holidayList = (
        new IncludeTimespanFilter(new IncludeUniqueDateFilter(new IncludeTypeFilter())))
            ->filter($holidayList, [
                IncludeTimespanFilter::PARAM_FIRST_DAY => $firstDay,
                IncludeTimespanFilter::PARAM_LAST_DAY => $lastDay,
                IncludeTypeFilter::PARAM_HOLIDAY_TYPE => HolidayType::DAY_OFF,
            ]);

        return $holidayList;
    }
2626
public function withDate(LocalDate $date) : LocalDateTime
    {
        if ($date->isEqualTo($this->date)) {
            return $this;
        }

        return new LocalDateTime($date, $this->time);
    }
250019
static function startTimestamp($date = '')
    {
        if (!$dateTime = static::parserDateTime($date)) return false;
        return mktime(0, 0, 0, $dateTime[3], $dateTime[4], $dateTime[5]);
    }
1338813
private static function cast(Date $date = null)
	{
		if (!is_null($date))
		{
			$date = new DateTime($date);
		}

		return $date;
	}
628882
public static function fromNativeDateTime(\DateTime $date)
    {
        $year  = \intval($date->format('Y'));
        $month = Month::fromNativeDateTime($date);
        $day   = \intval($date->format('d'));

        return new static(new Year($year), $month, new MonthDay($day));
    }
203072
public function getTimeOfDayForDate(\DateTime $date, \DateTime $time)
    {
        $hours = (int) $time->format('G');
        $minutes = (int) $time->format('i');
        $seconds = (int) $time->format('s');

        $dateTime = clone $date;
        $dateTime->setTime($hours, $minutes, $seconds);

        return $dateTime;
    }
1347823
public function isHoliday($iso, $date = 'now', $state = null)
    {
        return ($this->getHoliday($iso, $date, $state) !== null);
    }
1043190
public function dateIsLater(\DateTime $date) {
    $dateLater = FALSE;

    $t2 = $this->end_date->getTimeStamp();

    $t4 = $date->getTimestamp();

    if ($t2 < $t4) {
      $dateLater = TRUE;
    }

    return $dateLater;
  }
1191543
public function setDateTime($date, $diff = false) {
        $dateTemp = str_replace('/', '-', $date);
        $formatedDate = date($this->dateTimeFormat, strtotime($dateTemp));
        if ($diff) {
            $this->dateTimeDiff = null;
            $this->dateTimeDiff = new \DateTime($formatedDate);
        } else {
            $this->dateTime = null;
            $this->dateTime = new \DateTime($formatedDate);
        }
        return $this;
    }
1205334
private function setBatchRequest($state)
    {
        $this->_connection->setBatchRequest($state);
        $this->_processed = true;

        return $this;
    }
457932
public function formatDate($format, \DateTime $date = null)
    {
        if (null === $date) {
            return null;
        }

        return $date->format($format);
    }
530290
private function getDateBefore(\DateTime $date)
    {
        $tmpDate = clone $date;
        $tmpDate->modify('-1 day');

        $dayOfWeek = (int) $tmpDate->format('N');
        $closestDay = $this->getClosestDayBefore($dayOfWeek);

        if ($closestDay->getDayOfWeek() !== $dayOfWeek) {
            $tmpDate->modify(sprintf('last %s', Days::toString($closestDay->getDayOfWeek())));
        }

        return $tmpDate;
    }
1052607
public function parse($date, $locale = null)
    {
        $result = new \DateTime();
        $result->setTimestamp($this->parseTimestamp($date, $locale));

        return $result;
    }
682656
public static function FromDateTime( \DateTime $dt ) : DateTime
   {

      if ( $dt instanceof DateTime )
      {
         return clone $dt;
      }

      return new DateTime( $dt->format('Y-m-d H:i:s.u'), $dt->getTimezone() );

   }
1081439
private function getDateAfter(\DateTime $date)
    {
        $tmpDate = clone $date;
        $tmpDate->modify('+1 day');

        $dayOfWeek = (int) $tmpDate->format('N');
        $closestDay = $this->getClosestDayAfter($dayOfWeek);

        if ($closestDay->getDayOfWeek() !== $dayOfWeek) {
            $tmpDate->modify(sprintf('next %s', Days::toString($closestDay->getDayOfWeek())));
        }

        return $tmpDate;
    }