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


PHP JDate::format方法代码示例

本文整理汇总了PHP中JDate::format方法的典型用法代码示例。如果您正苦于以下问题:PHP JDate::format方法的具体用法?PHP JDate::format怎么用?PHP JDate::format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JDate的用法示例。


在下文中一共展示了JDate::format方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: removefromset

 /**
  * remove from set
  */
 function removefromset()
 {
     $model = $this->getModel();
     $table = $model->getTable();
     $key = $table->getKeyName();
     $urlVar = $key;
     $jinput = JFactory::getApplication()->input;
     $recordId = $jinput->getInt($urlVar);
     $recurrence_group = $jinput->getInt('recurrence_group');
     # Retrieve id of current event from recurrence_table
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select('id');
     $query->from($db->quoteName('#__jem_recurrence'));
     $query->where(array('groupid_ref = ' . $recurrence_group, 'itemid= ' . $recordId));
     $db->setQuery($query);
     $recurrenceid = $db->loadResult();
     # Update field recurrence_group in event-table
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->update('#__jem_events');
     $query->set(array('recurrence_count = ""', 'recurrence_freq = ""', 'recurrence_group = ""', 'recurrence_interval = ""', 'recurrence_until = ""', 'recurrence_weekday = ""'));
     $query->where('id = ' . $recordId);
     $db->setQuery($query)->query();
     # Blank field groupid_ref in recurrence-table and set exdate value
     $recurrence_table = JTable::getInstance('Recurrence', 'JEMTable');
     $recurrence_table->load($recurrenceid);
     $startdate_org_input = new JDate($recurrence_table->startdate_org);
     $exdate = $startdate_org_input->format('Ymd\\THis\\Z');
     $recurrence_table->exdate = $exdate;
     $recurrence_table->groupid_ref = "";
     $recurrence_table->store();
     # redirect back
     $this->setRedirect(JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, $urlVar), false));
 }
开发者ID:JKoelman,项目名称:JEM-3,代码行数:38,代码来源:event.php

示例2: getInput

 protected function getInput()
 {
     $class = !empty($this->class) ? $this->class : '';
     $required = $this->required ? ' required aria-required="true"' : '';
     $birthdayDay = '';
     $birthdayMonth = '01';
     $birthdayYear = '';
     // Prepare birthday
     if (!empty($this->value)) {
         $date = new Prism\Validator\Date($this->value);
         if (!$date->isValid()) {
             $birthdayDay = '';
             $birthdayMonth = '';
             $birthdayYear = '';
         } else {
             $date = new JDate($this->value);
             $birthdayDay = $date->format('d');
             $birthdayMonth = $date->format('m');
             $birthdayYear = $date->format('Y');
         }
     }
     $months = new Socialcommunity\Filter\Months();
     $html = array();
     $html[] = '<div class="' . $class . '">';
     $html[] = '    <input name="' . $this->name . '[day]"   value="' . $birthdayDay . '" id="birthday_day" class="col-md-3 ' . $class . '" type="text" placeholder="' . JText::_('COM_SOCIALCOMMUNITY_DAY') . '" ' . $required . '>';
     $html[] = JHTML::_('select.genericlist', $months->toOptions(), $this->name . '[month]', array('class' => 'col-md-3 ' . $class), 'text', 'value', $birthdayMonth, 'birthday_month');
     $html[] = '    <input name="' . $this->name . '[year]"  value="' . $birthdayYear . '" id="birthday_year"  class="col-md-4 ' . $class . '" type="text" placeholder="' . JText::_('COM_SOCIALCOMMUNITY_YEAR') . '" ' . $required . '>';
     $html[] = '</div>';
     return implode($html);
 }
开发者ID:ITPrism,项目名称:SocialCommunityDistribution,代码行数:30,代码来源:scbirthdayb3.php

示例3: display

 /**
  * Display the view
  */
 public function display($tpl = null)
 {
     // get the data
     $this->months = $this->get('Months');
     $this->month_days = $this->get('MonthDays');
     $this->month_start = $this->get('MonthStart');
     $this->month_16 = $this->get('Month16');
     $this->hotels = $this->get('Hotels');
     $this->hotel = $this->get('Hotel');
     $this->inventory = $this->get('Inventory');
     $this->bookings_in_progress = $this->get('BookingsInProgress');
     // filters
     $this->state = $this->get('State');
     // default dates
     $app = JFactory::getApplication();
     $date_format = CHPanelHelper::getDateFormat(JText::_('COM_CHPANEL_LOCALE'));
     // start & end
     $this->start = $app->getUserStateFromRequest('com_chpanel.manage.start', 'start', JFactory::getDate()->format($date_format), 'string');
     $this->end = $app->getUserStateFromRequest('com_chpanel.manage.end', 'end', JFactory::getDate('+ 1 day')->format($date_format), 'string');
     // title
     $date = new JDate('01-' . $this->state->get('filter.month'));
     $this->title = $this->hotel ? $this->hotel->title . ' - ' . $date->format('F Y') : $date->format('F Y');
     // toolbar
     CHPanelHelper::getToolbar('manage');
     // sidebar
     $this->sidebar = JHtmlSidebar::render();
     // display the view layout
     parent::display($tpl);
 }
开发者ID:moijafcor,项目名称:CHPanel-Lite,代码行数:32,代码来源:view.html.php

示例4: getInput

 protected function getInput()
 {
     $class = !empty($this->class) ? $this->class : '';
     $required = $this->required ? ' required aria-required="true"' : '';
     // Prepare birthday
     if (!empty($this->value)) {
         $date = new Prism\Validator\Date($this->value);
         if (!$date->isValid()) {
             $birthdayDay = "";
             $birthdayMonth = "";
             $birthdayYear = "";
         } else {
             $date = new JDate($this->value);
             $birthdayDay = $date->format("d");
             $birthdayMonth = $date->format("m");
             $birthdayYear = $date->format("Y");
         }
     }
     $html = array();
     $html[] = '<div class="' . $class . '">';
     $html[] = '    <input name="' . $this->name . '[day]"   value="' . $birthdayDay . '" id="birthday_day"   class="span3" type="text" placeholder="' . JText::_("COM_SOCIALCOMMUNITY_DAY") . '" ' . $required . '>';
     $html[] = '    <input name="' . $this->name . '[month]" value="' . $birthdayMonth . '" id="birthday_month" class="span3" type="text" placeholder="' . JText::_("COM_SOCIALCOMMUNITY_MONTH") . '" ' . $required . '>';
     $html[] = '    <input name="' . $this->name . '[year]"  value="' . $birthdayYear . '" id="birthday_year"  class="span4" type="text" placeholder="' . JText::_("COM_SOCIALCOMMUNITY_YEAR") . '" ' . $required . '>';
     $html[] = '</div>';
     return implode($html);
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:26,代码来源:scbirthdayb3.php

示例5: getInvoiceListParameters

 private function getInvoiceListParameters()
 {
     JLoader::import('joomla.utilities.date');
     $jNow = new JDate();
     $month = $this->input->getInt('month', 0);
     if ($month < 1 || $month > 12) {
         $month = (int) $jNow->format('m');
         $month--;
     }
     $year = $this->input->getInt('year', 0);
     if ($year < 2010 || $year > 2100) {
         $year = (int) $jNow->format('Y');
     }
     if ($month <= 0) {
         $month = 12;
         $year--;
     }
     $vies = false;
     $vatmoss = false;
     switch ($this->getTask()) {
         case 'vies':
             $vies = true;
             break;
         case 'vatmoss':
             $vatmoss = true;
             break;
     }
     $invoiceExtension = $this->input->getCmd('extension', 'akeebasubs');
     return array('month' => $month, 'year' => $year, 'vies' => $vies, 'vatmoss' => $vatmoss, 'extension' => $invoiceExtension);
 }
开发者ID:ZoiaoDePeixe,项目名称:akeebasubs,代码行数:30,代码来源:reports.php

示例6: build

 function build()
 {
     $formatedDate = "";
     if (!empty($this->dataValue) && $this->dataValue != "0000-00-00" && $this->dataValue != "00:00:00" && $this->dataValue != "0000-00-00 00:00:00") {
         jimport("joomla.utilities.date");
         $date = new JDate($this->dataValue);
         if ($tz = $this->timezone) {
             if ($tz == 'server') {
                 //TODO : Get the server timezone
                 $tz = 0;
                 //DBG
             } else {
                 if ($tz == 'local') {
                     //TODO : Get the current user local timezone
                     $tz = 0;
                     //DBG
                 }
             }
             $date->setOffset((int) $tz);
         }
         $formatedDate = $date->format($this->dateFormat, !empty($tz));
     }
     $this->addClass('fly-date');
     $html = '<span <%STYLE%><%CLASS%><%SELECTORS%>>' . $formatedDate . '</span>';
     return $html;
 }
开发者ID:gwtrains,项目名称:comRTiPrint,代码行数:26,代码来源:datetime.php

示例7: browse

 public function browse()
 {
     // Check permissions
     $this->_checkPermissions();
     // Set the profile
     $this->_setProfile();
     // Start the backup
     JLoader::import('joomla.utilities.date');
     AECoreKettenrad::reset(array('maxrun' => 0));
     AEUtilTempfiles::deleteTempFiles();
     AEUtilTempvars::reset(AKEEBA_BACKUP_ORIGIN);
     $kettenrad = AECoreKettenrad::load(AKEEBA_BACKUP_ORIGIN);
     $dateNow = new JDate();
     $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
     $options = array('description' => $description, 'comment' => '');
     $kettenrad->setup($options);
     $kettenrad->tick();
     $kettenrad->tick();
     $array = $kettenrad->getStatusArray();
     AECoreKettenrad::save(AKEEBA_BACKUP_ORIGIN);
     if ($array['Error'] != '') {
         // An error occured
         die('500 ERROR -- ' . $array['Error']);
     } else {
         $noredirect = $this->input->get('noredirect', 0, 'int');
         if ($noredirect != 0) {
             @ob_end_clean();
             echo "301 More work required";
             flush();
             JFactory::getApplication()->close();
         } else {
             $this->_customRedirect(JURI::base() . 'index.php?option=com_akeeba&view=backup&task=step&key=' . $this->input->get('key', '', 'none', 2) . '&profile=' . $this->input->get('profile', 1, 'int'));
         }
     }
 }
开发者ID:01J,项目名称:topm,代码行数:35,代码来源:backup.php

示例8: authenticate

 /**
  * Tries to authenticate the user and start the backup, or send him back to the default task
  */
 public function authenticate()
 {
     // Enforce raw mode - I need to be in full control!
     $document =& JFactory::getDocument();
     $document->setType('raw');
     if (!$this->_checkPermissions()) {
         parent::redirect();
     } else {
         $session =& JFactory::getSession();
         $session->set('litemodeauthorized', 1, 'akeeba');
         $this->_setProfile();
         jimport('joomla.utilities.date');
         AECoreKettenrad::reset();
         $memory_filename = AEUtilTempvars::get_storage_filename(AKEEBA_BACKUP_ORIGIN);
         @unlink($memory_filename);
         $kettenrad =& AECoreKettenrad::load(AKEEBA_BACKUP_ORIGIN);
         $user =& JFactory::getUser();
         $userTZ = $user->getParam('timezone', 0);
         $dateNow = new JDate();
         $dateNow->setOffset($userTZ);
         if (AKEEBA_JVERSION == '16') {
             $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
         } else {
             $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->toFormat(JText::_('DATE_FORMAT_LC2'));
         }
         $options = array('description' => $description, 'comment' => '');
         $kettenrad->setup($options);
         $ret = $kettenrad->tick();
         AECoreKettenrad::save(AKEEBA_BACKUP_ORIGIN);
         $this->setRedirect(JURI::base() . 'index.php?option=com_akeeba&view=light&task=step&key=' . urlencode(JRequest::getVar('key')) . '&profile=' . JRequest::getInt('profile') . '&format=raw');
     }
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:35,代码来源:light.php

示例9: testToString

 /**
  *	Testing toString
  *
  * @param string $format		How should the time be formatted?
  * @param string $expectedTime What should the resulting time string look like?
  *
  * @return void
  * @dataProvider casesToString
  */
 public function testToString($format, $expectedTime)
 {
     if (!is_null($format)) {
         JDate::$format = $format;
     }
     $this->assertThat($this->object->__toString(), $this->equalTo($expectedTime));
 }
开发者ID:nguyen1986vn,项目名称:atj25,代码行数:16,代码来源:JDateTest.php

示例10: formatDate

 public static function formatDate($date, $format = null, $jsFormat = true)
 {
     if (is_null($format)) {
         if (!($format = self::getDateFormat())) {
             reset(self::$_dateFormats);
             $format = key(self::$_dateFormats);
         }
     }
     if ($jsFormat) {
         if (isset(self::$_dateFormats[$format])) {
             $format = self::$_dateFormats[$format];
         } else {
             $format = reset(self::$_dateFormats);
         }
     }
     if ($date instanceof DateTime) {
         $timestamp = $date->getTimestamp();
     } else {
         if (is_int($date)) {
             $timestamp = $date;
         } else {
             $timestamp = strtotime((string) $date);
         }
     }
     //return date($format, $timestamp);
     $dt = new JDate($date);
     return $dt->format($format);
 }
开发者ID:greyhat777,项目名称:vuslinterliga,代码行数:28,代码来源:base.php

示例11: authenticate

 /**
  * Tries to authenticate the user and start the backup, or send him back to the default task
  */
 public function authenticate()
 {
     // Enforce raw mode - I need to be in full control!
     if (!$this->_checkPermissions()) {
         parent::redirect();
     } else {
         $session = JFactory::getSession();
         $session->set('litemodeauthorized', 1, 'akeeba');
         $this->_setProfile();
         JLoader::import('joomla.utilities.date');
         AECoreKettenrad::reset(array('maxrun' => 0));
         AEUtilTempvars::reset(AKEEBA_BACKUP_ORIGIN);
         $kettenrad = AECoreKettenrad::load(AKEEBA_BACKUP_ORIGIN);
         $dateNow = new JDate();
         /*
         $user = JFactory::getUser();
         $userTZ = $user->getParam('timezone',0);
         $dateNow->setOffset($userTZ);
         */
         $description = JText::_('BACKUP_DEFAULT_DESCRIPTION') . ' ' . $dateNow->format(JText::_('DATE_FORMAT_LC2'), true);
         $options = array('description' => $description, 'comment' => '');
         $kettenrad->setup($options);
         $ret = $kettenrad->tick();
         AECoreKettenrad::save(AKEEBA_BACKUP_ORIGIN);
         JFactory::getApplication()->redirect(JURI::base() . 'index.php?option=com_akeeba&view=light&task=step&key=' . urlencode($this->input->get('key', '', 'none', 2)) . '&profile=' . $this->input->get('profile', 1, 'int') . '&format=raw');
     }
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:30,代码来源:light.php

示例12: execute

    /**
     * Execute the controller.
     *
     * @return  string  The rendered view.
     */
    public function execute()
    {
        $db = JFactory::getDbo();
        $query = $db->getQuery(true);
        $query->select('*')->from('Comments');
        $db->setQuery($query);
        $comments = $db->loadAssocList();
        $commentMarkup = '';
        foreach ($comments as $comment) {
            $date = new JDate($comment['date']);
            $commentMarkup .= '<article><h3><a href="mailto:' . htmlspecialchars($comment['Email']) . '">' . htmlspecialchars($comment['Name']) . '</a> wrote:</h3>
			<p>' . htmlspecialchars($comment['Comment']) . '</p>
			<small>' . $date->format('d.m.Y', true) . ', ' . htmlspecialchars(long2ip($comment['Ip'])) . '</small></article>';
        }
        return '
				<form action="index.php" enctype="application/x-www-form-urlencoded" method="post">
					<fieldset>
						<input id="name" autofocus="autofocus" type="text" name="name" placeholder="Name" size="40" required="required" /><br />
						<input id="email" type="email" name="email" placeholder="E-Mail" size="40" required="required" /><br />
						<textarea id="comment" name="comment" placeholder="Your Comment" rows="10" cols="40" required="required"></textarea><br />
						<input type="hidden" name="task" value="add" />
						<input type="submit" vale="Send" />
					</fieldset>
				</form>
				<section>
					<h2>Comments</h2>
					' . $commentMarkup . '
				</section>
		';
    }
开发者ID:realityking,项目名称:jd12dk,代码行数:35,代码来源:display.php

示例13: date_bl

function date_bl($date, $time)
{
    return JSBaseView::formatDate($date . ' ' . $time);
    $format = "d-m-Y H:i";
    if ($date == '' || $date == '0000-00-00') {
        return '';
    }
    // $format = getJS_Config('date_format');
    // print_r($format);echo "<hr>";
    /*switch ($format){
    		case "d-m-Y H:i": $format = "%d-%m-%Y %H:%M"; break;
    		case "m-d-Y g:i A": $format = "%m-%d-%Y %I:%M %p"; break;
    		case "j F, Y H:i": $format = "%m %B, %Y %H:%M"; break;
    		case "j F, Y g:i A": $format = "%m %B, %Y %I:%H %p"; break;
    		case "d-m-Y": $format = "%d-%m-%Y"; break;
    		case "l d F, Y H:i": $format = "%A %d %B, %Y  %H:%M"; break;
    	}*/
    if (!$time) {
        $time = '00:00';
    }
    $time_m = explode(':', $time);
    $date_m = explode('-', $date);
    if (function_exists('date_default_timezone_set')) {
        date_default_timezone_set('GMT');
    }
    $tm = @mktime($time_m[0], $time_m[1], '0', $date_m[1], $date_m[2], $date_m[0]);
    jimport('joomla.utilities.date');
    $dt = new JDate($tm, null);
    return $dt->format($format);
}
开发者ID:greyhat777,项目名称:vuslinterliga,代码行数:30,代码来源:func.php

示例14: export

 public function export($event)
 {
     //CFactory::load( 'helpers' , 'event' );
     $handler = CEventHelper::getHandler($event);
     if (!$handler->showExport()) {
         echo JText::_('COM_COMMUNITY_ACCESS_FORBIDDEN');
         return;
     }
     header('Content-type: text/Calendar');
     header('Content-Disposition: attachment; filename="calendar.ics"');
     $creator = CFactory::getUser($event->creator);
     $offset = $creator->getUtcOffset();
     $date = new JDate($event->startdate);
     $dtstart = $date->format('Ymd\\THis');
     //$date->format('%Y%m%dT%H%M%S');
     $date = new JDate($event->enddate);
     $dtend = $date->format('Ymd\\THis');
     //$date->format('%Y%m%dT%H%M%S');
     $date = new JDate($event->repeatend);
     $rend = $date->format('Ymd\\THis');
     //$date->format('%Y%m%dT%H%M%S');
     $url = $handler->getFormattedLink('index.php?option=com_community&view=events&task=viewevent&eventid=' . $event->id, false, true);
     $tmpl = new CTemplate();
     $tmpl->set('dtstart', $dtstart);
     $tmpl->set('dtend', $dtend);
     $tmpl->set('rend', $rend);
     $tmpl->set('url', $url);
     $tmpl->set('event', $event);
     $raw = $tmpl->fetch('events.ical');
     unset($tmpl);
     echo $raw;
     exit;
 }
开发者ID:Jougito,项目名称:DynWeb,代码行数:33,代码来源:view.raw.php

示例15: loadFormData

 /**
  * Method to get the data that should be injected in the form.
  *
  * @return    mixed    The data for the form.
  * @since    1.6
  */
 protected function loadFormData()
 {
     $app = JFactory::getApplication();
     /** @var $app JApplicationSite */
     $data = $app->getUserState($this->option . '.edit.funding.data', array());
     if (!$data) {
         $itemId = (int) $this->getState($this->getName() . '.id');
         $userId = JFactory::getUser()->get("id");
         $data = $this->getItem($itemId, $userId);
         // Prepare date format.
         $dateFormat = CrowdfundingHelper::getDateFormat();
         $dateValidator = new Prism\Validator\Date($data->funding_end);
         // Validate end date. If the date is not valid, generate a valid one.
         // Use minimum allowed days to generate end funding date.
         if (!$dateValidator->isValid()) {
             // Get minimum days.
             $params = $this->getState("params");
             $minDays = $params->get("project_days_minimum", 30);
             // Generate end date.
             $today = new Crowdfunding\Date();
             $fundingEndDate = $today->calculateEndDate($minDays);
             $data->funding_end = $fundingEndDate->format("Y-m-d");
         }
         $date = new JDate($data->funding_end);
         $data->funding_end = $date->format($dateFormat);
     }
     return $data;
 }
开发者ID:pashakiz,项目名称:crowdf,代码行数:34,代码来源:funding.php


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