DateTimeImmutable::modify

(PHP 5 >= 5.5.0, PHP 7, PHP 8)

DateTimeImmutable::modifyCreates a new object with modified timestamp

說(shuō)明

public DateTimeImmutable::modify(string $modifier): DateTimeImmutable|false

Creates a new DateTimeImmutable object with modified timestamp. The original object is not modified.

參數(shù)

object

僅過(guò)程化風(fēng)格:由 date_create() 返回的 DateTime 類(lèi)型的對(duì)象。此函數(shù)會(huì)修改這個(gè)對(duì)象。

modifier

日期/時(shí)間字符串。正確格式的說(shuō)明詳見(jiàn) 日期與時(shí)間格式

返回值

Returns the newly created object 或者在失敗時(shí)返回 false.