略微加速

PHP官方手册 - 互联网笔记

PHP - Manual: MongoDate::toDateTime

2024-11-13

MongoDate::toDateTime

(PECL mongo >= 1.6.0)

MongoDate::toDateTimeReturns a DateTime object representing this date

说明

public MongoDate::toDateTime ( void ) : DateTime

Returns the DateTime representation of this date. The returned DateTime will use the UTC time zone.

参数

此函数没有参数。

返回值

This date as a DateTime object.

范例

Example #1 MongoDate::toDateTime() example

This example demonstrates creating a DateTime object from a MongoDate object.

<?php
$d 
= new MongoDate(strtotime("2014-11-18 11:01:25"));
var_dump$d->toDateTime() );
?>

以上例程的输出类似于:

class DateTime#2 (3) {
  public $date =>
  string(26) "2014-11-18 11:01:25.000000"
  public $timezone_type =>
  int(1)
  public $timezone =>
  string(6) "+00:00"
}
add a note add a note

User Contributed Notes

There are no user contributed notes for this page.

官方地址:https://www.php.net/manual/en/mongodate.todatetime.php

北京半月雨文化科技有限公司.版权所有 京ICP备12026184号-3