|
DateTimeImmutable::modifyCreates a new object with modified timestamp Description
public DateTimeImmutablefalse DateTimeImmutable::modify(string
$modifier )Creates a new DateTimeImmutable object with modified timestamp. The original object is not modified. Parameters
Return Values
Returns a new modified DateTimeImmutable object or Errors/ExceptionsIf an invalid Date/Time string is passed, DateMalformedStringException is thrown. Previous to PHP 8.3, this was a warning. Changelog
ExamplesExample #1 DateTimeImmutable::modify example Object-oriented style
The above examples will output: 2006-12-13 Example #2 Beware when adding or subtracting months
The above example will output: 2001-01-31 2001-03-03 See Also
|