/** * Returns a copy of this {@code LocalDateTime} with the month-of-year altered. * <p> * The time does not affect the calculation and will be the same in the result. * If the day-of-month is invalid for the year, it will be changed to the last valid day of the month. * <p> * This instance is immutable and unaffected by this method call. * * @param int $month the month-of-year to set in the result, from 1 (January) to 12 (December) * @return LocalDateTime a {@code LocalDateTime} based on this date-time with the requested month, not null * @throws DateTimeException if the month-of-year value is invalid */ public function withMonth($month) { return $this->_with($this->date->withMonth($month), $this->time); }