本文整理汇总了PHP中XLite\Core\Converter::formatDate方法的典型用法代码示例。如果您正苦于以下问题:PHP Converter::formatDate方法的具体用法?PHP Converter::formatDate怎么用?PHP Converter::formatDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XLite\Core\Converter
的用法示例。
在下文中一共展示了Converter::formatDate方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getViewValue
/**
* Get view value
*
* @param array $field Field
*
* @return mixed
*/
protected function getViewValue(array $field)
{
$value = parent::getViewValue($field);
if (is_scalar($value)) {
$value = \XLite\Core\Converter::formatDate($value);
}
return $value;
}
示例2: getDefaultOptions
/**
* Get default options
*
* @return array
*/
protected function getDefaultOptions()
{
$time = \XLite\Core\Converter::time();
$allowedDateFormats = \XLite\Core\Converter::getAvailableDateFormats();
$options = array();
foreach ($allowedDateFormats as $phpFormat => $formats) {
$options[$phpFormat] = \XLite\Core\Converter::formatDate($time, $phpFormat);
}
return $options;
}
示例3: getExpiredKeys
/**
* Get list of expired keys
*
* @return array
*/
public function getExpiredKeys()
{
if (!isset($this->expiredKeys)) {
$this->expiredKeys = array();
$entries = \XLite\Upgrade\Cell::getInstance()->getEntries();
$keys = \XLite\Core\Database::getRepo('XLite\\Model\\ModuleKey')->findAll();
$commonURLPart = 'https://secure.x-cart.com/customer.php?target=generate_invoice&action=buy&';
$urlParamsAggregated = array();
$i = 1;
foreach ($keys as $key) {
$entityID = 'CDev' == $key->getAuthor() && 'Core' == $key->getName() ? \XLite\Upgrade\Cell::CORE_IDENTIFIER : $key->getAuthor() . '\\' . $key->getName();
$keyData = $key->getKeyData();
if (!empty($keyData['message']) && in_array($entityID, array_keys($entries))) {
$urlParamsAggregated[] = $this->getKeyURLParams($i++, $key);
$title = isset($entries[$entityID]) ? sprintf('%s (%s)', $entries[$entityID]->getName(), $entries[$entityID]->getAuthor()) : sprintf('%s (%s)', $key->getName(), $key->getAuthor());
$this->expiredKeys[] = array('title' => $title, 'expDate' => \XLite\Core\Converter::formatDate($keyData['expDate']), 'purchaseURL' => $commonURLPart . $this->getKeyURLParams(1, $key) . '&proxy_checkout=1');
}
}
$this->allKeysPurchaseURL = $urlParamsAggregated ? $commonURLPart . implode('&', $urlParamsAggregated) . '&proxy_checkout=1' : null;
}
return $this->expiredKeys;
}
示例4: getDayDate
/**
* Get day of the given date
*
* @param integer $date Date (UNIX timestamp)
*
* @return string
*/
protected function getDayDate($date)
{
return \XLite\Core\Converter::formatDate($date);
}
示例5: getValueAsString
/**
* Get widget value as string
*
* @return string
*/
public function getValueAsString()
{
return 0 >= $this->getParam(self::PARAM_VALUE) ? '' : \XLite\Core\Converter::formatDate($this->getParam(self::PARAM_VALUE), null, false);
}
示例6: formatDate
/**
* Format date
*
* @param mixed $base String or object instance to get field value from
* @param string $field Field to get value OPTIONAL
* @param string $format Date format OPTIONAL
*
* @return string
*/
protected function formatDate($base, $field = null, $format = null)
{
if (is_object($base)) {
$base = $base instanceof \XLite\Model\AEntity ? $base->{$field} : $base->get($field);
}
return \XLite\Core\Converter::formatDate($base, $format);
}
示例7: getCurrentYear
/**
* getCurrentYear
*
* @return string
*/
protected function getCurrentYear()
{
return \XLite\Core\Converter::formatDate(time(), '%Y');
}
示例8: getDefaultOptions
/**
* Get default options
*
* @return array
*/
protected function getDefaultOptions()
{
$time = time();
return array('%T' => \XLite\Core\Converter::formatDate($time, '%T'), '%H:%M' => \XLite\Core\Converter::formatDate($time, '%H:%M'), '%I:%M %p' => \XLite\Core\Converter::formatDate($time, '%I:%M %p'), '%r' => \XLite\Core\Converter::formatDate($time, '%r'));
}
示例9: getPackExportDate
/**
* Get last export date
*
* @return string
*/
protected function getPackExportDate()
{
$list = $this->getPackedFiles();
$file = $list ? new \SplFileInfo(current($list)) : null;
$date = date('Y-m-d');
if ($file) {
$date = \XLite\Core\Converter::formatDate($file->getMTime(), '%Y-%m-%d');
}
return $date;
}
示例10: getCommonAttributes
/**
* getCommonAttributes
*
* @return array
*/
protected function getCommonAttributes()
{
$list = parent::getCommonAttributes();
if (is_numeric($list['value']) || is_int($list['value'])) {
$list['value'] = $list['value'] ? \XLite\Core\Converter::formatDate($list['value']) : '';
}
return $list;
}
示例11: getCompanyYear
/**
* Get company year
*
* @return string
*/
protected function getCompanyYear()
{
$currentYear = intval(\XLite\Core\Converter::formatDate(\XLite\Core\Converter::time(), '%Y'));
$startYear = \XLite::isAdminZone() ? 2002 : intval(\XLite\Core\Config::getInstance()->Company->start_year);
return $startYear && $startYear < $currentYear ? $startYear . ' - ' . $currentYear : $currentYear;
}
示例12: getLastExportDate
/**
* Get last export date
*
* @return string
*/
protected function getLastExportDate()
{
$list = $this->getDownloadFiles();
$file = $list ? current($list) : null;
return \XLite\Core\Converter::formatDate($file ? $file->getMTime() : \XLite\Core\Converter::time());
}
示例13: getDefaultOptions
/**
* Get default options
*
* @return array
*/
protected function getDefaultOptions()
{
$time = time();
return array('%m/%d/%Y' => \XLite\Core\Converter::formatDate($time, '%m/%d/%Y'), '%b %e, %Y' => \XLite\Core\Converter::formatDate($time, '%b %e, %Y'), '%d.%m.%Y' => \XLite\Core\Converter::formatDate($time, '%d.%m.%Y'));
}