
MongoDBBSONUTCDateTime::toDateTimeImmutable 메서드는 DateTimeImmutable 인스턴스를 반환합니다.
이 메서드를 사용하여 DateTimeImmutable을 생성하는 방법은 다음과 같습니다.
#hostingforum.kr
php
$utcDateTime = new MongoDBBSONUTCDateTime();
$dateTimeImmutable = $utcDateTime->toDateTimeImmutable();
또한, MongoDBBSONUTCDateTime의 timestamp를 사용하여 DateTimeImmutable을 생성하는 방법은 다음과 같습니다.
#hostingforum.kr
php
$timestamp = 1643723400;
$dateTimeImmutable = new DateTimeImmutable('@' . $timestamp);
위 코드는 MongoDBBSONUTCDateTime의 timestamp가 1643723400인 경우 DateTimeImmutable을 생성하는 예제입니다.
위 코드는 PHP에서 MongoDBBSONUTCDateTime을 사용하여 DateTimeImmutable을 생성하는 방법을 설명합니다.
2025-07-09 12:41