本文整理匯總了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();
}