DateTimeImmutable::setTime Sets the time &reftitle.description; #[\NoDiscard] public DateTimeImmutableDateTimeImmutable::setTime inthour intminute intsecond0 intmicrosecond0 Returns a new DateTimeImmutable object with the time set to the given time. &reftitle.parameters; hour Hour of the time. minute Minute of the time. second Second of the time. microsecond Microsecond of the time. &reftitle.returnvalues; &date.datetimeimmutable.return.modifiedobject; &reftitle.changelog; &Version; &Description; 8.1.0 The behaviour with double existing hours (during the fall-back DST transition) changed. Previously PHP would pick the second occurrence (after the DST transition), instead of the first occurrence (before DST transition). 7.1.0 The microsecond parameter was added. &reftitle.examples; <function>DateTimeImmutable::setTime</function> example &style.oop; setTime(14, 55); echo $newDate->format('Y-m-d H:i:s') . "\n"; $newDate = $date->setTime(14, 55, 24); echo $newDate->format('Y-m-d H:i:s') . "\n"; ?> ]]> &example.outputs.similar; Values exceeding ranges are added to their parent values setTime(14, 55, 24); echo $newDate->format('Y-m-d H:i:s') . "\n"; $newDate = $date->setTime(14, 55, 65); echo $newDate->format('Y-m-d H:i:s') . "\n"; $newDate = $date->setTime(14, 65, 24); echo $newDate->format('Y-m-d H:i:s') . "\n"; $newDate = $date->setTime(25, 55, 24); echo $newDate->format('Y-m-d H:i:s') . "\n"; ?> ]]> &example.outputs; &reftitle.seealso; DateTimeImmutable::setDate DateTimeImmutable::setISODate