MongoDateConversion
Can be used by any class which accesses MongoDB.
Instance Methods
Returns | Signature and Description |
---|---|
? DateTime | toDateTime ( , )Tries to convert a |
? DateTimeImmutable | toDateTimeImmutable ( )Tries to convert a |
Method Details
toDateTime
protected function
toDateTime
(mixed
$value
, ?
DateTimeZone
$timeZone = null
)Tries to convert a UTCDateTime
into a DateTime
.
Name | Type | Description |
---|---|---|
$value | mixed | The value to convert |
$timeZone | ? DateTimeZone | Optional Time Zone to set |
Type | Description |
---|---|
? DateTime | The date if |
toDateTimeImmutable
protected function
toDateTimeImmutable
(mixed
$value
)Tries to convert a UTCDateTime
into a DateTimeImmutable
.
Name | Type | Description |
---|---|---|
$value | mixed | The value to convert |
Type | Description |
---|---|
? DateTimeImmutable | The date if |