Skip to content

Commit

Permalink
Merge pull request #7781 from tybulewicz/patch-1
Browse files Browse the repository at this point in the history
Missing method `getUtc` added
  • Loading branch information
lcobucci authored Jul 26, 2019
2 parents 376c5e1 + 4993c4a commit a896421
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/en/cookbook/working-with-datetime.rst
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ the UTC time at the time of the booking and the timezone the event happened in.
$converted = \DateTime::createFromFormat(
$platform->getDateTimeFormatString(),
$value,
self::$utc ? self::$utc : self::$utc = new \DateTimeZone('UTC')
self::getUtc()
);
if (! $converted) {
Expand All @@ -126,6 +126,11 @@ the UTC time at the time of the booking and the timezone the event happened in.
return $converted;
}
private static function getUtc()
{
return self::$utc ? self::$utc : self::$utc = new \DateTimeZone('UTC');
}
}
This database type makes sure that every DateTime instance is always saved in UTC, relative
Expand Down

0 comments on commit a896421

Please sign in to comment.