Skip to content

Commit a5bc4e3

Browse files
committed
MAGETWO-35359: Inconsistent timestamp return for Magento admin panel timezone
1 parent 8e30a58 commit a5bc4e3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,11 @@ public function formatDate($date = null, $format = \IntlDateFormatter::SHORT, $s
197197
public function scopeTimeStamp($scope = null)
198198
{
199199
$timezone = $this->_scopeConfig->getValue($this->getDefaultTimezonePath(), $this->_scopeType, $scope);
200-
return (new \DateTime('now', new \DateTimeZone($timezone ?: 'UTC')))->getTimestamp();
200+
$currentTimezone = @date_default_timezone_get();
201+
@date_default_timezone_set($timezone);
202+
$date = date('Y-m-d H:i:s');
203+
@date_default_timezone_set($currentTimezone);
204+
return strtotime($date);
201205
}
202206

203207
/**

0 commit comments

Comments
 (0)