Changes the current defined day to defined value.

@param  integer $day The new day value. If the value NULL is used it means: Use the day of NOW()
@return \Beluga\Date\DateTime
196842
public final function setDay( int $day = null )
      : DateTime
   {

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

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

   }
1230169
public function addDays($value) {
        
        $dayToSet = (int) $this->day + $value;
        
        return $this->setDate($this->year, $this->month, $dayToSet);
    }
1356391
public function withDay(int $day) : MonthDay
    {
        if ($day === $this->day) {
            return $this;
        }

        Field\DayOfMonth::check($day, $this->month);

        return new MonthDay($this->month, $day);
    }
413233
private function setDay($day) {
        
        //preventing duplication process
        if ($day == $this->day) {
            return;
        }
        $maximumDayOfMonth = static::getMonthLength($this->month, $this->year);
        $dayToSet          = $day;
        if ($dayToSet < 1) {
            
            $dayToSet = abs($dayToSet);
            
            while ($dayToSet > $maximumDayOfMonth) {
                $dayToSet -= $maximumDayOfMonth;
                $month    = $this->month - 1;
                $this->setMonth($month);
                $maximumDayOfMonth = static::getMonthLength($this->month, $this->year);
            }
            
            $dayToSet = $maximumDayOfMonth - $dayToSet;
            $month    = $this->month - 1;
            $this->setMonth($month);
            
        } elseif ($dayToSet > $maximumDayOfMonth) {
            while ($dayToSet > $maximumDayOfMonth) {
                $dayToSet -= $maximumDayOfMonth;
                $month    = $this->month + 1;
                $this->setMonth($month);
                $maximumDayOfMonth = static::getMonthLength($this->month, $this->year);
            }
        }
        
        $this->day = (int) $dayToSet;
    }
293106
public function setTime($value = null)
    {
        switch ($value) {
            case 'today':
                $this->_params['time'] = 'today';
                break;
            case 'this_week':
                $this->_params['time'] = 'this_week';
                break;
            case 'this_month':
                $this->_params['time'] = 'this_month';
                break;
            case 'all_time':
                $this->_params['time'] = 'all_time';
                break;
            case null:
                unset($this->_params['time']);
            default:
                require_once 'Zend/Gdata/App/InvalidArgumentException.php';
                throw new Zend_Gdata_App_InvalidArgumentException(
                    'Unknown time value');
                break;
        }
        return $this;
    }
500083
private function getDifference($value): ?int
    {
        // Let's prepare the dates...
        $now = (new \DateTime())->setTime(0, 0);
        $date = Date::getDateTime($value);

        // ...and make comparison with "day" as unit
        if ($date instanceof \DateTime) {
            return Date::getDateDifference($now, $date, Date::DATE_DIFFERENCE_UNIT_DAYS);
        }

        return null;
    }
599777
public function weeklyOn($day, $time = '0:0'): self
    {
        $this->dailyAt($time);

        return $this->spliceIntoPosition(5, (string) $day);
    }
705254
public function plusDays(int $days) : LocalDate
    {
        if ($days === 0) {
            return $this;
        }

        return LocalDate::ofEpochDay($this->toEpochDay() + $days);
    }
296662
public function addDayInterval(int $day): self
	{
		if ($day > 0) {
			$this->dayIntervals[] = $day;
			sort($this->dayIntervals);
		}
		return $this;
	}
1323294
public function setDate($date, $diff = false) {
        $dateTemp = str_replace('/', '-', $date);
        $formatedDate = date($this->dateFormat, strtotime($dateTemp));
        list($year, $month, $day) = explode("-", $formatedDate);
        if ($diff) {
            $this->dateTimeDiff = null;
            $this->dateTimeDiff = new \DateTime();
            $this->dateTimeDiff->setDate($year, $month, $day);
        } else {
            $this->dateTime = null;
            $this->dateTime = new \DateTime();
            $this->dateTime->setDate($year, $month, $day);
        }
        return $this;
    }
1013725
public static function setDay($ts = null, $day = 1)
	{
		list($H, $i, $s, $m, $d, $Y) = sfDateTimeToolkit::breakdown($ts);
		
		return mktime($H, $i, $s, $m, $day, $Y);
	}
432151
public function setDate($date)
    {
        $this->add(self::PERIOD, $date->getPeriod());
        $this->add(self::DATE, $date->getDate());

        return $this;
    }
948860
function RemoveDay(Day $day)
    {
        $result = array();
        foreach ($this->days as $currentDay)
        {
            if ($currentDay->DayOfWeek != $day->DayOfWeek())
                $result[] = $currentDay;
        }
        $this->days = $result;
    }
846111
public function setDayInterval(array $days): self
	{
		$this->dayIntervals = [];
		foreach ($days as $day) {
			$this->addDayInterval($day);
		}
		return $this;
	}
861342
public function translate($date): Date
    {
        $handle = Date::castFrom($date)->handle();
        $handle->setTimezone($this->timeZone);
        return new Date($handle);
    }
196676
public static function dateAddDay($date, $day)
    {
        $daystr = "+$day day";
        $dateday = date("Y-m-d", strtotime($daystr, strtotime($date)));
        return $dateday;
    }
761497
public function setStartDate($date)
    {
        $date = AnDomainAttributeDate::getInstance()->setDate($date);
        $this->set('startDate', $date);

        return $this;
    }