DateTimeImmutable::createFromMutable

(PHP 5 >= 5.6.0, PHP 7)

DateTimeImmutable::createFromMutableReturns new DateTimeImmutable object encapsulating the given DateTime object

说明

public static DateTimeImmutable::createFromMutable ( DateTime $datetime ) : DateTimeImmutable

参数

datetime

The mutable DateTime object that you want to convert to an immutable version. This object is not modified, but instead a new DateTimeImmutable object is created containing the same date time and timezone information.

范例

Example #1 Creating an immutable date time object

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

$immutable DateTimeImmutable::createFromMutable$date );
?>

返回值

Returns a new DateTimeImmutable instance.

相关文章
php datetimeinterface returns the difference between two datetime objectsphp datetimeimmutable returns new datetimeimmutable objectphp datetimeimmutable returns new datetimeimmutable object encapsulating the given datetime objectphp datetimeimmutable creates a new object with modified timestampphp domcdatasection constructs a new domcdatasection objectphp deque returns a sub deque of a given rangephp cairo 函数 returns a new cairocontext object on the requested surfacephp ps 函数 creates a new postscript document objectphp imagick returns a new imagick objectphp mongodate returns a datetime object representing this datephp mongodb bson utcdatetimeinterface returns the datetime representation of this utcdatetimeinterfacephp mongodb driver writeconcern returns an object for bson serializationphp ktaglib mpeg file returns an object that provides access to the audio propertiesphp mysqli stmt returns the number of parameter for the given statementphp mysqlnduhconnection returns the number of warnings from the last query for the given linkphp sdo das xml 函数 returns sdo das xml document object for a given path to xml instance documentphp swfmovie creates a new movie object representing an swf version 4 moviephp swfsound returns a new swfsound object from given filephp swftext writes the given text into this swftext object at the current pen position using the current font height spacing and colorphp tidy returns a tidynode object starting from the head tag of the tidy parse tree
关注编程学问公众号