本文整理匯總了PHP中Magento\Framework\Stdlib\DateTime\DateTime::getGmtOffset方法的典型用法代碼示例。如果您正苦於以下問題:PHP DateTime::getGmtOffset方法的具體用法?PHP DateTime::getGmtOffset怎麽用?PHP DateTime::getGmtOffset使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\Stdlib\DateTime\DateTime
的用法示例。
在下文中一共展示了DateTime::getGmtOffset方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGetGmtOffset
public function testGetGmtOffset()
{
$this->assertSame(-28800, $this->dateTime->getGmtOffset('seconds'));
$this->assertSame(-28800, $this->dateTime->getGmtOffset('seconds11'));
$this->assertSame(-480, $this->dateTime->getGmtOffset('minutes'));
$this->assertSame(-8, $this->dateTime->getGmtOffset('hours'));
}
示例2: _afterLoadData
/**
* @return $this
*/
protected function _afterLoadData()
{
parent::_afterLoadData();
if ($this->_addDaysInWishlist) {
$gmtOffset = (int) $this->_date->getGmtOffset();
$nowTimestamp = $this->_date->timestamp();
foreach ($this as $wishlistItem) {
$wishlistItemTimestamp = $this->_date->timestamp($wishlistItem->getAddedAt());
$wishlistItem->setDaysInWishlist((int) (($nowTimestamp - $gmtOffset - $wishlistItemTimestamp) / 24 / 60 / 60));
}
}
return $this;
}
示例3: __construct
/**
* @param IFormat $toolFormat
* @param \Magento\Framework\Stdlib\DateTime\DateTime $dateTime
*/
public function __construct(IFormat $toolFormat, \Magento\Framework\Stdlib\DateTime\DateTime $dateTime)
{
$this->_toolFormat = $toolFormat;
$this->_tzDelta = $dateTime->getGmtOffset();
}
示例4: render
/**
* Prepare link to display in grid
*
* @param \Magento\Framework\DataObject $row
* @return string
*/
public function render(\Magento\Framework\DataObject $row)
{
$time = date('Y-m-d H:i:s', strtotime($row->getSitemapTime()) + $this->_date->getGmtOffset());
return $time;
}
示例5: getTimezoneOffsetSeconds
/**
* Return offset of current timezone with GMT in seconds
*
* @return int
*/
public function getTimezoneOffsetSeconds()
{
return $this->_date->getGmtOffset();
}