DateTime::createFromImmutable

(PHP 7 >= 7.3.0, PHP 8)

DateTime::createFromImmutable与えられた DateTimeImmutable オブジェクトをカプセル化した、新しい DateTime オブジェクトを返す

説明

public static DateTime::createFromImmutable(DateTimeImmutable $object): DateTime

パラメータ

object

変更可能なバージョンに変換が必要な、 DateTimeImmutable オブジェクト。 このオブジェクトは変更されませんが、 代わりに同じ日付、時刻、タイムゾーンの情報を含んだ 新しい DateTime オブジェクトが作られます。

返り値

新しい DateTime インスタンスを返します。

例1 変更可能な日付オブジェクトを作る

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

$mutable DateTime::createFromImmutable$date );
?>

add a note add a note

User Contributed Notes

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