Search Results
Returns a new DateTimeImmutable object with the time set to the given time.
DateTimeImmutable::setTime 26 déc. 2018 13 fois (PHP 5 >= 5.5.0, PHP 7, PHP 8) DateTimeImmutable::setTime — Définit l'horaire
DateTimeImmutable::setISODate — Sets the ISO date DateTimeImmutable::setTime — Sets the time DateTimeImmutable::setTimestamp — Sets the date and time based on a Unix timestamp DateTimeImmutable::setTimezone — Sets the time zone DateTimeImmutable::sub — Subtracts an amount of days, months, years, hours, minutes and seconds
The DateTimeImmutable class is the immutable analogue of DateTime. It creates a new object with any modification, making it more predictable and safe to work with. Current Moment in Time Let's create a DateTimeImmutable object with the current date and time:
Simple usage example of `DateTimeImmutable::setTime ()`. DateTimeImmutable::setTime is a PHP function that allows you to modify the time value of a DateTimeImmutable object. This function takes in separate parameters for hours, minutes, seconds, and optionally microseconds, and updates the time portion of the DateTimeImmutable object accordingly. Unlike the setTime method in the DateTime class ...
The new setMicrosecond and getMicrosecond methods are not the only way to set and get the microsecond amounts from DateTime and DateTimeImmutable objects. The easiest approach is the setTime method, which accepts the microsecond amount: ... The downside of this approach is that the hour, minute, and second values must be known.
Feb 11, 2021 · The DateTimeImmutable::setTime () function is an inbuilt function in PHP which is used to sets the desired time by resetting the current time of the created DateTimeImmutable object.
