DateTime::createFromImmutable

(PHP 7 >= 7.3.0, PHP 8)

DateTime::createFromImmutable — 주어진 DateTimeImmutable 객체를 캡슐화하는 새로운 DateTime 객체를 반환합니다.


설명

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


매개변수

object
변경할 수 있는 버전으로 변환해야 하는 변경할 수 없는 DateTimeImmutable 개체입니다. 이 개체는 수정되지 않지만 대신 동일한 날짜, 시간 및 시간대 정보를 포함하는 new DateTime 개체가 생성됩니다.

반환 값

new DateTime 인스턴스를 반환합니다.


Examples

예제 #1 변경 가능한 날짜 시간 객체 생성

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

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