本文整理汇总了PHP中JDate::createFromFormat方法的典型用法代码示例。如果您正苦于以下问题:PHP JDate::createFromFormat方法的具体用法?PHP JDate::createFromFormat怎么用?PHP JDate::createFromFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDate
的用法示例。
在下文中一共展示了JDate::createFromFormat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: calendar
function calendar()
{
$date = JDate::createFromFormat('Y', $_POST['year']);
$min_date = clone $date;
$min_date = $min_date->modify('-1 year');
$max_date = $date->modify('+1 year');
$calendar_attributes = array('min_select_year' => $min_date->format('Y'), 'max_select_year' => $max_date->format('Y'));
if (isset($_REQUEST['action']) and $_REQUEST['action'] == 'pn_get_month_cal') {
require_once JPATH_COMPONENT_ADMINISTRATOR . '/classes/calendar.php';
AImporter::css('calendar');
$calendar = new PN_Calendar($calendar_attributes);
echo $calendar->draw(array(), $_REQUEST['year'], $_REQUEST['month']);
exit;
}
}
示例2: calendar
function calendar()
{
$date = JDate::createFromFormat('Y', $_POST['year']);
$min_date = clone $date;
$min_date = $min_date->modify('-1 year');
$max_date = $date->modify('+1 year');
$calendar_attributes = array('min_select_year' => $min_date->format('Y'), 'max_select_year' => $max_date->format('Y'));
if (isset($_REQUEST['action']) and $_REQUEST['action'] == 'pn_get_month_cal') {
AImporter::classes('dayoffcalendar');
AImporter::css('calendar');
$calendar = new PN_Calendar($calendar_attributes);
echo $calendar->draw(array(), $_REQUEST['year'], $_REQUEST['month']);
exit;
}
}
示例3: index
protected function index()
{
$indexingParams = array();
if ($this->input->getString('u') || $this->input->getString('update')) {
$lastModified = $this->input->getString('u', $this->input->getString('update'));
$d = JDate::createFromFormat("Y-m-d\\TH:i:sP", $lastModified, new DateTimeZone(JFactory::getConfig()->get('offset')));
$valid = false;
if ($d) {
if ($d->getTimezone()) {
$format = "Y-m-d\\TH:i:s" . ($d->getTimezone()->getName() == 'Z' ? '\\Z' : 'P');
if ($d->format($format) == $lastModified) {
$valid = true;
}
}
}
if ($valid) {
$indexingParams['lastModified'] = $lastModified;
} else {
$client = \JSolr\Index\Factory::getService();
if ($client->ping()) {
$response = $client->luke();
$indexingParams['lastModified'] = $response->index->lastModified;
}
}
}
$start = new JDate('now');
$this->out("crawl start " . $start->format("c"));
$this->_fireEvent('onIndex', array(get_class($this), $this->_isVerbose(), $indexingParams), $this->_getPlugin());
$end = new JDate('now');
$this->out("crawl end " . $end->format("c"));
$time = $start->diff($end);
$this->out("execution time: " . $time->format("%H:%I:%S"));
}