本文整理汇总了PHP中Localization::setDateFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP Localization::setDateFormat方法的具体用法?PHP Localization::setDateFormat怎么用?PHP Localization::setDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Localization
的用法示例。
在下文中一共展示了Localization::setDateFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: DateTimeValue
/**
* Return formated date
*
* @access public
* @param DateTimeValue $value If value is not instance of DateTime object new DateTime
* object will be created with $value as its constructor param
* @param string $format If $format is NULL default date format will be used
* @param float $timezone Timezone, if NULL it will be autodetected (by currently logged user if we have it)
* @return string
*/
function format_date($value = null, $format = null, $timezone = null) {
if(is_null($timezone) && function_exists('logged_user') && (logged_user() instanceof Contact)) {
$timezone = logged_user()->getTimezone();
} // if
$datetime = $value instanceof DateTimeValue ? $value : new DateTimeValue($value);
if ($format){
$l = new Localization();
$l->setDateFormat($format);
}else
$l = Localization::instance();
return $l->formatDate($datetime, $timezone);
} // format_date
示例2: clean
$alldayevents[$task->getId()] = $task;
}
$added = true;
}
}
}
}
if (is_array($birthdays)) {
$alldayevents = array_merge($alldayevents, $birthdays);
}
$alldaygridHeight = count($alldayevents) * PX_HEIGHT / 2 + PX_HEIGHT / 3;
if ($alldaygridHeight > 150) {
$alldaygridHeight = 150;
}
$loc = new Localization();
$loc->setDateFormat(lang('view date title', $date_format));
$view_title = $loc->formatDate($dtv);
// lang(strtolower(date('l', $dtv))) . date(' j, ', $dtv) . lang('month ' . date('n', $dtv)) . date(' Y', $dtv);
$users_array = array();
$companies_array = array();
foreach ($users as $u) {
$users_array[] = $u->getArrayInfo();
}
foreach ($companies as $company) {
$companies_array[] = $company->getArrayInfo();
}
?>
<div id="calHiddenFields">
<input type="hidden" id="hfCalUsers" value="<?php
echo clean(str_replace('"', "'", escape_character(json_encode($users_array))));
?>
示例3: clean
if ($task->getDueDate() instanceof DateTimeValue && $dtv->getTimestamp() == mktime(0, 0, 0, $task->getDueDate()->getMonth(), $task->getDueDate()->getDay(), $task->getDueDate()->getYear())) {
continue;
}
if ($task->getStartDate() instanceof DateTimeValue && $dtv->getTimestamp() == mktime(0, 0, 0, $task->getStartDate()->getMonth(), $task->getStartDate()->getDay(), $task->getStartDate()->getYear())) {
continue;
}
unset($tmp_tasks[$k]);
}
$alldayevents = array_merge($alldayevents, $tmp_tasks);
}
if (is_array($birthdays)) {
$alldayevents = array_merge($alldayevents, $birthdays);
}
$alldaygridHeight = count($alldayevents) * PX_HEIGHT / 2 + PX_HEIGHT / 3;
$loc = new Localization();
$loc->setDateFormat(lang('view date title'));
$view_title = $loc->formatDate($dtv);
// lang(strtolower(date('l', $dtv))) . date(' j, ', $dtv) . lang('month ' . date('n', $dtv)) . date(' Y', $dtv);
$users_array = array();
$companies_array = array();
foreach ($users as $u) {
$users_array[] = $u->getArrayInfo();
}
foreach ($companies as $company) {
$companies_array[] = $company->getArrayInfo();
}
?>
<div id="calHiddenFields">
<input type="hidden" id="hfCalUsers" value="<?php
echo clean(str_replace('"', "'", str_replace("'", "\\'", json_encode($users_array))));
?>