Returns a copy of this LocalDate with the day-of-month altered.

If the resulting date is invalid, an exception is thrown.

@param int $day

@return LocalDate

@throws DateTimeException If the day is invalid for the current year and month.
435750
public function withDay(int $day) : LocalDate
    {
        if ($day === $this->day) {
            return $this;
        }

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

        return new LocalDate($this->year, $this->month, $day);
    }
1132430
public static function create(int $year, int $month, int $day): Date
    {
        return new static($year, $month, $day);
    }
1223591
public static function getSeasonFromRyzomDay($day)
    {
        return (int) fmod(fmod($day, self::RYZOM_YEAR_IN_DAY) / self::RYZOM_SEASON_IN_DAY, 4);
    }
884617
static LocalDate toLocalDate(final Calendar self) {
        return LocalDate.of(self.get(Calendar.YEAR), toMonth(self), self.get(Calendar.DAY_OF_MONTH));
    }
889191
function(year, month, day) {
			if (!this._calendar.isValid(year, month, day)) {
				throw ($.calendars.local.invalidDate || $.calendars.regionalOptions[''].invalidDate).
					replace(/\{0\}/, this._calendar.local.name);
			}
			this._year = year;
			this._month = month;
			this._day = day;
			return this;
		}
922429
protected function dateTime(): DateTimeImmutable
    {
        if ($this->dateTime === null) {
            $year = $this->year();
            $month = $this->month();
            $day = $this->day();
            $hour = $this->hour();
            $minute = $this->minute();
            $second = $this->second();
            $timezone = $this->timezone()->toString();
            $this->dateTime = self::createNative($year, $month, $day, $hour, $minute, $second, $timezone);
        }

        return $this->dateTime;
    }
1297946
public static function from(DateTimeParseResult $result) : LocalDate
    {
        $year  = (int) $result->getField(Field\Year::NAME);
        $month = (int) $result->getField(Field\MonthOfYear::NAME);
        $day   = (int) $result->getField(Field\DayOfMonth::NAME);

        return LocalDate::of($year, $month, $day);
    }
1255502
public function withMonth(int $month) : ZonedDateTime
    {
        return ZonedDateTime::of($this->localDateTime->withMonth($month), $this->timeZone);
    }
571804
public function plusMonths(int $months) : LocalDate
    {
        $month = $this->month + $months - 1;

        $yearDiff = Math::floorDiv($month, 12);
        $month = Math::floorMod($month, 12) + 1;

        $year = $this->year + $yearDiff;

        return $this->resolvePreviousValid($year, $month, $this->day);
    }
196676
public static function dateAddDay($date, $day)
    {
        $daystr = "+$day day";
        $dateday = date("Y-m-d", strtotime($daystr, strtotime($date)));
        return $dateday;
    }
620006
public function setDate($year, $month, $day) : \DateTime /*self invariant*/
    {
        if ($this->frozen) {
            throw new \RuntimeException(get_class($this) . ' is read-only, frozen.');
        }
        return parent::setDate($year, $month, $day);
    }
255146
public function setDate($year, $month, $day) {
		$this->set("$year/$month/$day ".$this->format('HH:mm:ss'), null, 'yyyy/MM/dd HH:mm:ss');
		return $this;
	}
921811
public function days($date = null)
	{
		return is_string($date) ? (new \DateTime($date, self::$utc))->diff($this->date)->days : $date->diff($this->date)->days;
	}
460432
public static Day getDay(Integer day)
   {
      Day result = null;
      if (day != null)
      {
         result = DAY_ARRAY[day.intValue()];
      }
      return (result);
   }
1100204
function Copy()
     {
         return new Date($this->Day(), $this->Month(), $this->Year(),
                         $this->Hour(), $this->Minute(), $this->Second());
     }
912647
public function withDateAt(int $year = null, int $month = null, int $day = null) : self
    {
        if (null === $year && null === $month && null === $day) {
            return $this;
        }
        
        $year  = $year === null ? $this->year() : $year;
        $month = $month ?: $this->month();
        $day   = $day   ?: $this->day();
        
        $instance = clone $this;
        
        $instance->date->setDate($year, $month, $day);
        
        return $instance;
    }
17163
public static function getCurrentDayOfWeek()
    {
        $now = new DateTime();

        $year = $now->format('Y');
        $month = $now->format('m');
        $day = $now->format('d');

        return self::getDayOfWeek($year, $month, $day);
    }