/** * Returns a copy of this LocalDateTime with the time altered. * * @param LocalTime $time * * @return LocalDateTime */ public function withTime(LocalTime $time) { if ($time->isEqualTo($this->time)) { return $this; } return new LocalDateTime($this->date, $time); }