Statement on glibc/iconv Vulnerability

DateTimeImmutable::createFromInterface

(PHP 8)

DateTimeImmutable::createFromInterface指定された DateTimeInterface オブジェクトをカプセル化した、新しい DateTimeImmutable オブジェクトを返す

説明

public static DateTimeImmutable::createFromInterface(DateTimeInterface $object): DateTimeImmutable

パラメータ

object

変更できないバージョンに変換する DateTimeInterface オブジェクト。 このオブジェクトは変更されませんが、 同じ日付、時刻、タイムゾーンの情報が入った新しい DateTimeImmutable オブジェクトが作成されます。

戻り値

新しいDateTimeImmutable クラスのインスタンスを返します。

例1 DateTimeImmutable オブジェクトを作る

<?php
$date
= new DateTime("2014-06-20 11:45 Europe/London");

$immutable = DateTimeImmutable::createFromInterface($date);

$date = new DateTimeImmutable("2014-06-20 11:45 Europe/London");
$also_immutable = DateTimeImmutable::createFromInterface($date);
?>

add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top