MongoDB\BSON\UTCDateTime::toDateTime
(mongodb >=1.0.0)
MongoDB\BSON\UTCDateTime::toDateTime — 이 UTCDateTime의 DateTime 표현을 반환합니다.
설명
final public MongoDB\BSON\UTCDateTime::toDateTime(): DateTime
매개변수
이 함수에는 매개변수가 없습니다.
반환 값
이 UTCDateTime의 DateTime 표현을 반환합니다. 반환된 DateTime은 UTC 표준 시간대를 사용합니다.
오류/예외
- 인수 구문 분석 오류에 대해 MongoDB\Driver\Exception\InvalidArgumentException을 던집니다.
Examples
예제 #1 MongoDB\BSON\UTCDatetime::toDateTime() 예제
<?php
$utcdatetime = new MongoDB\BSON\UTCDateTime(1416445411987);
$datetime = $utcdatetime->toDateTime();
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" }