(PHP 5 >= 5.5.0, PHP 7, PHP 8)
日付と時刻を表現します。
このクラスは DateTime と同じ振る舞いをします。 但し、DateTime::modify() のような、 状態を変更して新しいオブジェクトを返すメソッドが呼び出された時を除きます。
message: "as DateTimeImmutable::add() does not modify the object itself")]$interval): DateTimeImmutable$format, string $datetime, ?DateTimeZone $timezone = null): DateTimeImmutable|falsemessage: "as DateTimeImmutable::modify() does not modify the object itself")]$modifier): DateTimeImmutablemessage: "as DateTimeImmutable::setDate() does not modify the object itself")]$year, int $month, int $day): DateTimeImmutablemessage: "as DateTimeImmutable::setISODate() does not modify the object itself")]$year, int $week, int $dayOfWeek = 1): DateTimeImmutablemessage: "as DateTimeImmutable::setMicrosecond() does not modify the object itself")]$microsecond): staticmessage: "as DateTimeImmutable::setTime() does not modify the object itself")]$hour,$minute,$second = 0,$microsecond = 0message: "as DateTimeImmutable::setTimestamp() does not modify the object itself")]$timestamp): DateTimeImmutablemessage: "as DateTimeImmutable::setTimezone() does not modify the object itself")]$timezone): DateTimeImmutablemessage: "as DateTimeImmutable::sub() does not modify the object itself")]$interval): DateTimeImmutablesince: '8.5',message: 'this method is obsolete, as serialization hooks are provided by __unserialize() and __serialize()',
| バージョン | 説明 |
|---|---|
| 8.4.0 | クラス定数が型付けされました。 |
| 7.1.0 |
DateTimeImmutable のコンストラクタで構築される値に、
現在時刻のマイクロ秒が含まれるようになりました。
これより前のバージョンでは、このマイクロ秒の情報は常に
0 で初期化されていました。
|