本文整理汇总了PHP中JDate::Format方法的典型用法代码示例。如果您正苦于以下问题:PHP JDate::Format方法的具体用法?PHP JDate::Format怎么用?PHP JDate::Format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDate
的用法示例。
在下文中一共展示了JDate::Format方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
$post = JRequest::get('post');
$post['eventdescription'] = JRequest::getVar('eventdescription', '', 'POST', 'string', JREQUEST_ALLOWRAW);
## Make a proper date of the event date and closing date.
jimport('joomla.utilities.date');
$date = new JDate($post['closingdate']);
$post['closingdate'] = $date->Format('Y-m-d');
$date = new JDate($post['eventdate']);
$post['eventdate'] = $date->Format('Y-m-d');
if (JRequest::getVar('venue', 0)) {
$msg = JText::_('COM_TICKETMASTER_EVENT_NOT_SAVED_ERROR_VENUE');
$link = 'index.php?option=com_ticketmaster&controller=events';
$this->setRedirect($link, $msg);
}
$model =& $this->getModel('events');
if ($model->store($post)) {
$msg = JText::_('COM_TICKETMASTER_EVENT_SAVED');
} else {
$msg = JText::_('COM_TICKETMASTER_EVENT_NOT_SAVED');
}
$link = 'index.php?option=com_ticketmaster&controller=events';
$this->setRedirect($link, $msg);
}
示例2: elseif
if (!$item->lastvisit_html) {
$htmlDate = JText::_('Date_Never');
} elseif ($item->lastvisit_html > $now - 3600) {
// Less than one hour
$htmlDate = JText::sprintf('Date_Minutes_Ago', intval(($now - $item->lastvisit_html) / 60));
} elseif ($item->lastvisit_html > $now - 86400) {
// Less than one day
$hours = intval(($now - $item->lastvisit_html) / 3600);
$htmlDate = JText::sprintf('Date_Hours_Minutes_Ago', $hours, ($now - $hours * 3600 - $item->lastvisit_html) / 60);
} elseif ($item->lastvisit_html > $now - 259200) {
// Less than three days
$days = intval(($now - $item->lastvisit_html) / 86400);
$htmlDate = JText::sprintf('Date_Days_Hours_Ago', $days, intval(($now - $days * 86400 - $item->lastvisit_html) / 3600));
} else {
$date = new JDate($item->lastvisit_html);
$htmlDate = $date->Format('%Y-%m-%d %H:%M');
}
if (!$item->lastvisit_xml) {
$xmlDate = JText::_('Date_Never');
} elseif ($item->lastvisit_xml > $now - 3600) {
// Less than one hour
$xmlDate = JText::sprintf('Date_Minutes_Ago', intval(($now - $item->lastvisit_xml) / 60));
} elseif ($item->lastvisit_xml > $now - 86400) {
// Less than one day
$hours = intval(($now - $item->lastvisit_xml) / 3600);
$xmlDate = JText::sprintf('Date_Hours_Minutes_Ago', $hours, ($now - $hours * 3600 - $item->lastvisit_xml) / 60);
} elseif ($item->lastvisit_xml > $now - 259200) {
// Less than three days
$days = intval(($now - $item->lastvisit_xml) / 86400);
$xmlDate = JText::sprintf('Date_Days_Hours_Ago', $days, intval(($now - $days * 86400 - $item->lastvisit_xml) / 3600));
} else {
示例3: JDate
<?php
echo $this->item->introtext;
?>
</div>
<?php
// echo "<pre>";
// print_r($this->item);
// echo "</pre>";
?>
<div class="right-section">
<div class="location">
<div class="date">
<?php
$pub_date = new JDate($this->item->publish_up);
echo $pub_date->Format("j M Y h:i:a");
?>
</div>
<?php
$metinfo = new JRegistry();
$metinfo->loadString($this->item->metadata);
?>
<div class="city">
<?php
echo $metinfo->get("xreference");
?>
</div>
<div class="suburb">
<?php
echo $metinfo->get("rights");
?>
示例4: save
//.........这里部分代码省略.........
}
}
}
$post = JRequest::get('post');
$params = JComponentHelper::getParams('com_users');
$useractivation = $params->get('useractivation');
if ($config->auto_username == 1) {
$data['username'] = $post['emailaddress'];
$chars = '123456789ABCDEFGHJKLMNPQRSTUVWXYZ';
$data['password'] = self::password(8, $chars);
} else {
$to_be_replaced = array("#", "&", "!", "\$", "^", "%", "(", ")", "=", "+", "/", "<", ">", ";", ":", "[", "]", "{", "}", "FROM", "from", "UPDATE", "update", "DELETE", "delete", "+");
$data['username'] = str_replace($to_be_replaced, "", $post['username']);
$data['password'] = $post['password'];
}
$data['name'] = $post['firstname'] . ' ' . $post['name'];
$data['firstname'] = $post['firstname'];
$data['email'] = $post['emailaddress'];
$model = $this->getModel('checkout');
## Attempt to save the data.
## receive back the userid.
$userid = $model->register($data, $config);
$post['userid'] = $userid;
$post['ipaddress'] = $_SERVER['REMOTE_ADDR'];
$post['published'] = 1;
if ($config->show_birthday == 1) {
## Creating the birthday
$post['birthday'] = $post['year'] . '-' . $post['month'] . '-' . $post['day'];
## Make date save:
jimport('joomla.utilities.date');
$date = new JDate($post['birthday']);
$isJ30 = version_compare(JVERSION, '3.0.0', 'ge');
if ($isJ30) {
$birthday = $date->Format('Y-m-d');
} else {
$birthday = $date->toFormat('Y-m-d');
}
$post['birthday'] = $birthday;
}
## Save userdata in Ticketmaster tables.
$model->store($post);
## Flush the data from the session.
$app->setUserState('com_ticketmaster.registration', null);
## Let's change order status now. They are now
## connected to a user with an id.
$model->itemsupdate($userid, $this->ordercode);
## Mail the userinformation ot this customer.
$model->sendconfirmation($userid, $data['password'], $data['username'], $this->email, $this->ordercode, $this->name);
## Check what type of registration it is in config.
$useractivation = $params->get('useractivation');
if ($useractivation == 1) {
## Message for showing redirections
$msg = JText::_('COM_TICKETMASTER_ACTIVATE_ACCOUNT');
## URL to redirect the customer after registration.
$url = JRoute::_('index.php?option=com_ticketmaster&view=checkout');
## Redirect customer to specific page
$app->redirect($url, $msg);
} elseif ($useractivation == 2) {
## Message for showing redirections
$msg = JText::_('COM_TICKETMASTER_CANNOT_COMPLETE_ORDER');
## URL to redirect the customer after registration.
$url = JRoute::_('index.php?option=com_ticketmaster&view=checkout');
## Redirect customer to specific page
$app->redirect($url, $msg);
} else {
## Get the config values needed for the signups.