phpday 2027 - Call for Papers

date_create_immutable

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

date_create_immutable — 新しい DateTimeImmutable オブジェクトを作成する

説明

function date_create_immutable(string $datetime = "now", ?DateTimeZone $timezone = null): DateTimeImmutable|false

これは DateTimeImmutable::__construct() の手続き型バージョンです。

DateTimeImmutable のコンストラクタと異なり、 datetime が不正な文字列だった場合には 例外をスローする代わりに false を返します。

パラメータ

DateTimeImmutable::__construct を参照ください。

戻り値

新しい DateTimeImmutable のインスタンスを返します。失敗した場合に false を返します

参考

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top