diff --git a/src/Monolog/Formatter/MongoDBFormatter.php b/src/Monolog/Formatter/MongoDBFormatter.php index 6d9456be..0630f7c3 100644 --- a/src/Monolog/Formatter/MongoDBFormatter.php +++ b/src/Monolog/Formatter/MongoDBFormatter.php @@ -102,13 +102,6 @@ class MongoDBFormatter implements FormatterInterface protected function formatDate(\DateTimeInterface $value, $nestingLevel) { - $seconds = (int) $value->format('U'); - $milliseconds = (int) $value->format('u') / 1000; - - if ($seconds < 0) { - return new UTCDateTime($seconds * 1000 - $milliseconds); - } else { - return new UTCDateTime($seconds * 1000 + $milliseconds); - } + return new UTCDateTime((int) ($value->format('U.u') * 1000)); } }