MongoDB\BSON\UTCDateTime::__construct
MongoDB\BSON\UTCDateTime::__toString
MongoDB\BSON\UTCDateTime
PHP Manual

# MongoDB\BSON\UTCDateTime::toDateTime

(mongodb >=1.0.0)

MongoDB\BSON\UTCDateTime::toDateTime — Returns the DateTime representation of this UTCDateTime

### Description

final public DateTime MongoDB\BSON\UTCDateTime::toDateTime ( void )

### Parameters

This function has no parameters.

### Return Values

Returns the DateTime representation of this UTCDateTime.

### Errors/Exceptions

- Throws MongoDB\Driver\Exception\InvalidArgumentException on argument parsing errors.

### Examples

Example #1 MongoDB\BSON\UTCDatetime::toDateTime() example

`<?php
$utcdatetime = new MongoDB\BSON\UTCDateTime(1416445411987);
$datetime = $utcdatetime->toDateTime();
var_dump($datetime->format(DATE_RSS));
?>`

The above example will output something similar to:

    string(31) "Thu, 20 Nov 2014 01:03:31 +0000"

### See Also

- » BSON Types: Date

MongoDB\BSON\UTCDateTime::__construct
MongoDB\BSON\UTCDateTime::__toString
MongoDB\BSON\UTCDateTime
PHP Manual