当前位置: 首页>>代码示例>>PHP>>正文


PHP JDate::Format方法代码示例

本文整理汇总了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);
 }
开发者ID:novalnetuser,项目名称:Jeremiah-s-Ranch,代码行数:24,代码来源:events.php

示例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 {
开发者ID:educakanchay,项目名称:educared,代码行数:31,代码来源:modal.php

示例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");
?>
开发者ID:iFactoryDigital,项目名称:gympieradiology,代码行数:31,代码来源:joblist_item.php

示例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.
开发者ID:novalnetuser,项目名称:Jeremiah-s-Ranch,代码行数:67,代码来源:checkout.php


注:本文中的JDate::Format方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。