
MongoDBBSONUTCDateTimeInterface::toDateTime 메서드는 UTC DateTime 객체를 반환합니다.
이 메서드는 MongoDB의 BSON 타입인 DateTime을 PHP의 DateTime 객체로 변환하는 데 사용됩니다.
다음과 같은 예제를 통해 사용법을 이해할 수 있습니다.
#hostingforum.kr
php
$dateTime = new MongoDBBSONUTCDateTime();
$phpDateTime = $dateTime->toDateTime();
echo $phpDateTime->format('Y-m-d H:i:s');
위의 예제에서, MongoDB\BSON\UTCDateTime 객체를 사용하여 DateTime 객체를 생성하고, format 메서드를 사용하여 날짜와 시간을 문자열로 변환합니다.
이러한 방법으로 MongoDBBSONUTCDateTimeInterface::toDateTime 메서드를 사용하여 날짜와 시간을 변환할 수 있습니다.
2025-08-03 03:44