本文整理汇总了PHP中Magento\Framework\Stdlib\DateTime\TimezoneInterface::getDateTimeFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP TimezoneInterface::getDateTimeFormat方法的具体用法?PHP TimezoneInterface::getDateTimeFormat怎么用?PHP TimezoneInterface::getDateTimeFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\Stdlib\DateTime\TimezoneInterface
的用法示例。
在下文中一共展示了TimezoneInterface::getDateTimeFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getFormattedOptionValue
/**
* Return formatted option value for quote option
*
* @param string $optionValue Prepared for cart option value
* @return string
*/
public function getFormattedOptionValue($optionValue)
{
if ($this->_formattedOptionValue === null) {
$option = $this->getOption();
if ($this->getOption()->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DATE) {
$format = $this->_localeDate->getDateFormat(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM);
$result = $this->_localeDate->date($optionValue, \Zend_Date::ISO_8601, null, false)->toString($format);
} elseif ($this->getOption()->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_DATE_TIME) {
$format = $this->_localeDate->getDateTimeFormat(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_SHORT);
$result = $this->_localeDate->date($optionValue, \Magento\Framework\Stdlib\DateTime::DATETIME_INTERNAL_FORMAT, null, false)->toString($format);
} elseif ($this->getOption()->getType() == \Magento\Catalog\Model\Product\Option::OPTION_TYPE_TIME) {
$date = new \Magento\Framework\Stdlib\DateTime\Date($optionValue);
$result = date($this->is24hTimeFormat() ? 'H:i' : 'h:i a', $date->getTimestamp());
} else {
$result = $optionValue;
}
$this->_formattedOptionValue = $result;
}
return $this->_formattedOptionValue;
}
示例2: exportStartDatetime
/**
* Convert the start datetime (if set) to proper locale/timezone and return
*
* @return string
*/
public function exportStartDatetime()
{
$datetime = $this->getStartDatetime();
if (!$datetime || !$this->_localeDate || !$this->_store) {
return '';
}
$date = $this->_localeDate->scopeDate($this->_store, strtotime($datetime), true);
return $date->toString($this->_localeDate->getDateTimeFormat(TimezoneInterface::FORMAT_TYPE_SHORT));
}
示例3: setQueueStartAtByString
/**
* Set $_data['queue_start'] based on string from backend, which based on locale.
*
* @param string|null $startAt start date of the mailing queue
* @return $this
*/
public function setQueueStartAtByString($startAt)
{
if (is_null($startAt) || $startAt == '') {
$this->setQueueStartAt(null);
} else {
$format = $this->_localeDate->getDateTimeFormat(\Magento\Framework\Stdlib\DateTime\TimezoneInterface::FORMAT_TYPE_MEDIUM);
$time = $this->_localeDate->date($startAt, $format)->getTimestamp();
$this->setQueueStartAt($this->_date->gmtDate(null, $time));
}
return $this;
}