Skip to content

Commit 4ed7520

Browse files
committed
Include miliseconds in Date objects
1 parent 9acc5ae commit 4ed7520

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/DateTime.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ class DateTime extends \DateTime
1313
//switch from regular datetime to safe version
1414
private static function createFromRegular(\DateTime $datetime): self
1515
{
16-
return new self($datetime->format('Y-m-d H:i:s'), $datetime->getTimezone());
16+
return new self($datetime->format('Y-m-d H:i:s.v'), $datetime->getTimezone());
1717
}
1818

1919
/**

lib/DateTimeImmutable.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function __construct($time = 'now', $timezone = null)
3535
//switch from regular datetime to safe version
3636
private static function createFromRegular(\DateTimeImmutable $datetime): self
3737
{
38-
$safeDatetime = new self($datetime->format('Y-m-d H:i:s'), $datetime->getTimezone()); //we need to also update the wrapper to not break the operators '<' and '>'
38+
$safeDatetime = new self($datetime->format('Y-m-d H:i:s.v'), $datetime->getTimezone()); //we need to also update the wrapper to not break the operators '<' and '>'
3939
$safeDatetime->innerDateTime = $datetime;
4040
return $safeDatetime;
4141
}

0 commit comments

Comments
 (0)