Search Results
Resets the current date of the DateTime object to a different date. Like DateTimeImmutable::setDate () but works with DateTime, and changes the existing object. The procedural version takes the DateTime object as its first argument.
Oct 10, 2019 · The DateTime::setDate () function is an inbuilt function in PHP which is used to reset the current date of DateTime object with the given date-time object. Syntax:
PHP 5 >= 5.2.0, PHP 7, PHP 8 DateTime::setDate - Sets the date Manual Code Examples
The setDate method of the DateTime class sets a new date for the DateTime object. Let's look at its features with examples.
Assigne la date courante de l'objet DateTime à une nouvelle date. Comme DateTimeImmutable:: setDate () mais fonctionne avec DateTime et modifie l'objet existant. La version procédurale prend un objet DateTime comme premier argument.
The DateTime class Introduction ¶ Representation of date and time. This class behaves the same as DateTimeImmutable, except objects are modified itself when modification methods such as DateTime::modify () are called.
People also ask
How to reset date in PHP?
How to handle date and time in PHP?
What is a procedural version of datetime?
What is the difference between procedural style and datetimeimmutable?
The PHP date_default_timezone_set () Function Note that the date() function will return the current local date/time of your server! To get the date and time to be correct according to a specific location, also set the timezone you want to use, with the date_default_timezone_set() function.
