本文整理汇总了PHP中Magento\Framework\Stdlib\DateTime\TimezoneInterface::utcDate方法的典型用法代码示例。如果您正苦于以下问题:PHP TimezoneInterface::utcDate方法的具体用法?PHP TimezoneInterface::utcDate怎么用?PHP TimezoneInterface::utcDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Stdlib\DateTime\TimezoneInterface
的用法示例。
在下文中一共展示了TimezoneInterface::utcDate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: timeShift
/**
* Retrieve time shift
*
* @param string $datetime
* @return string
*/
public function timeShift($datetime)
{
return $this->_localeDate->utcDate(null, $datetime, true, \Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT)->toString(\Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT);
}
示例2: importBuyRequest
/**
* Collect needed information from buy request
* Then filter data
*
* @param \Magento\Framework\Object $buyRequest
* @return $this
* @throws \Magento\Framework\Model\Exception
* @throws \Exception
*/
public function importBuyRequest(\Magento\Framework\Object $buyRequest)
{
$startDate = $buyRequest->getData(self::BUY_REQUEST_START_DATETIME);
if ($startDate) {
if (!$this->_localeDate || !$this->_store) {
throw new \Exception('Locale and store instances must be set for this operation.');
}
$dateFormat = $this->_localeDate->getDateTimeFormat(TimezoneInterface::FORMAT_TYPE_SHORT);
$localeCode = $this->_localeResolver->getLocaleCode();
if (!\Zend_Date::isDate($startDate, $dateFormat, $localeCode)) {
throw new \Magento\Framework\Model\Exception(__('The recurring payment start date has invalid format.'));
}
$utcTime = $this->_localeDate->utcDate($this->_store, $startDate, true, $dateFormat)->toString(\Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT);
$this->setStartDatetime($utcTime)->setImportedStartDatetime($startDate);
}
return $this->_filterValues();
}