One day helper
Sets event to a single day

@param \DateTime $on
@return \Ical\Component\Event
12262
public function on(DateTime $on) {
        if ($on->format('His') !== '000000') {
            throw new RuntimeException('One day events must start at midnight');
        }

        $fin = clone $on;
        $fin->add(new \DateInterval('P1D'));

        $this->start($on)
                ->end($fin)
                ->allDay(true);

        return $this;
    }
612428
public function setDateFromDateTime(DateTime $date = NULL, DateTimeZone $dateTimeZone = NULL) {
    $dateTimeZone = !empty($dateTimeZone) ? $dateTimeZone : new DateTimeZone('UTC');
    $this->date = !empty($date) ? $date : new DateTime($date);
    $this->date->setTimezone($dateTimeZone);
  }
1321171
public function setDateTime($dateTime)
	{
		$this->registry()->register(self::REGISTRY_DATETIME, $dateTime, true);
		return $this;
	}
731652
public function addDateOff(\DateTime $holiday)
    {
        $this->datesOff[] = $holiday
            ->setTimezone(new \DateTimeZone('UTC'))
            ->setTime(0, 0, 0);

        return $this;
    }
387552
public function setStartDate(\DateTime $startDate)
    {
        $this->startDate = $startDate
            ->setTimezone(new \DateTimeZone('UTC'))
            ->setTime(0, 0, 0);

        return $this;
    }
4327
public function setISODate( $year, $week, $day = null )
      : DateTime
   {

      parent::setISODate( $year, $week, $day );

      return $this;

   }
196842
public final function setDay( int $day = null )
      : DateTime
   {

      if ( \is_null( $day ) )
      {
         $day = static::CurrentDay();
      }

      return $this->setDateParts( null, null, $day );

   }
1093519
public function setDateFrom($date)
    {
        $date = static::instance($date);

        $this->setDate($date->year, $date->month, $date->day);

        return $this;
    }
846447
public function withYear(int $year): DateTime
    {
        return new static(
            Date::create($year, $this->month(), $this->day()),
            $this->time(),
            $this->timezone()
        );
    }
439983
public function setStart(DateTime $start)
    {
        if ($this->end && $start > $this->end) {
            throw new EventException(
                'New start comes after the end!',
                EventException::INVALID_DATES
            );
        }
        $this->start = clone $start;
        return $this;
    }
641113
public function setDate(\DateTime $dateTime)
    {
        $this->set(Config::T540, $dateTime->format('Ymd'));

        return $this;
    }
693527
public function setDeletedOn($deleted_on) {
        
        $this -> deleted_on = $deleted_on !== null ? new \DateTime($deleted_on) : null;
        return $this;
    }
646568
public function withHour(int $hour): DateTime
    {
        return new static(
            $this->date(),
            Time::create($hour, $this->minute(), $this->second()),
            $this->timezone()
        );
    }
172285
public function setDate($key, DateTime $value)
    {
        $this->set(self::DATE, $key, $value);

        return $this;
    }
1335462
public function addDays($days)
    {
        $time=$this->_time+3600*24*$days;
        $obj=new DateTime($time);
        return $obj;
    }
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));
    }
494405
public static function fromNative(DateTimeInterface $dateTime): Date
    {
        $year = (int) $dateTime->format('Y');
        $month = (int) $dateTime->format('n');
        $day = (int) $dateTime->format('j');

        return new static($year, $month, $day);
    }