We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 90f73d2 commit 2f92654Copy full SHA for 2f92654
src/Jenssegers/Mongodb/Eloquent/Model.php
@@ -99,7 +99,13 @@ protected function asDateTime($value)
99
{
100
// Convert UTCDateTime instances.
101
if ($value instanceof UTCDateTime) {
102
- return Date::createFromTimestampMs($value->toDateTime()->format('Uv'));
+ $date = $value->toDateTime();
103
+
104
+ $seconds = $date->format('U');
105
+ $milliseconds = abs($date->format('v'));
106
+ $timestampMs = sprintf('%d%03d', $seconds, $milliseconds);
107
108
+ return Date::createFromTimestampMs($timestampMs);
109
}
110
111
return parent::asDateTime($value);
0 commit comments