MongoDB\BSON\UTCDateTime::toDateTimeImmutable
(mongodb >=1.20.0)
MongoDB\BSON\UTCDateTime::toDateTimeImmutable — Returns the DateTimeImmutable representation of this UTCDateTime
説明
パラメータ
この関数にはパラメータはありません。
戻り値
Returns the DateTimeImmutable representation of this UTCDateTime. The returned DateTimeImmutable will use the UTC time zone.
エラー / 例外
- Throws MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors.
例
例1 MongoDB\BSON\UTCDatetime::toDateTimeImmutable() example
<?php
$utcdatetime = new MongoDB\BSON\UTCDateTime(1416445411987);
$datetime = $utcdatetime->toDateTimeImmutable();
var_dump($datetime->format('r'));
var_dump($datetime->format('U.u'));
var_dump($datetime->getTimezone());
?>
上の例の出力は、 たとえば以下のようになります。
string(31) "Thu, 20 Nov 2014 01:03:31 +0000" string(17) "1416445411.987000" object(DateTimeZone)#3 (2) { ["timezone_type"]=> int(1) ["timezone"]=> string(6) "+00:00" }
参考
- MongoDB\BSON\UTCDateTime::toDateTime() - Returns the DateTime representation of this UTCDateTime
- » BSON Types: Date
+add a note
User Contributed Notes
There are no user contributed notes for this page.
↑ and ↓ to navigate •
Enter to select •
Esc to close
Press Enter without
selection to search using Google