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


PHP date::format方法代码示例

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


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

示例1: setEstimatedEndDate

 /**
  * Set estimated_end_date
  *
  * @param date $estimated_end_date
  */
 public function setEstimatedEndDate($estimated_end_date)
 {
     if ($this->getId() && $this->estimated_end_date != $estimated_end_date) {
         $current = isset($this->estimated_end_date) ? $this->estimated_end_date->format('Y-m-d') : '';
         $this->getLastNote()->addChange("Estimated end date changed from '{$current}' to '{$estimated_end_date->format('Y-m-d')}'");
     }
     if ($this->getOriginalEstimatedEndDate() == null) {
         $this->setOriginalEstimatedEndDate($estimated_end_date);
     }
     $this->estimated_end_date = $estimated_end_date;
 }
开发者ID:jackbravo,项目名称:symfony-sandbox,代码行数:16,代码来源:Project.php

示例2: __set

 /**
  * Magic setter
  *
  * @param  string  $key
  * @param  mixed   $value
  */
 public function __set($key, $value)
 {
     switch ($key) {
         // Date of birth
         case 'dob':
             $value = date::format(date::DATE_SQL, $value);
             break;
             // Always lowercase e-mail
         // Always lowercase e-mail
         case 'email':
             $value = utf8::strtolower($value);
             break;
     }
     parent::__set($key, $value);
 }
开发者ID:netbiel,项目名称:core,代码行数:21,代码来源:user.php

示例3: __set

 /**
  * Magic setter
  *
  * @param  string  $key
  * @param  mixed   $value
  */
 public function __set($key, $value)
 {
     switch ($key) {
         // Date of birth
         case 'dob':
             $value = date::format(date::DATE_SQL, $value);
             break;
             // Always lowercase e-mail
         // Always lowercase e-mail
         case 'email':
             $value = utf8::strtolower($value);
             break;
             // Use Auth to hash the password
         // Use Auth to hash the password
         case 'password':
             $value = Visitor::instance()->hash_password($value);
             break;
     }
     parent::__set($key, $value);
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:26,代码来源:user.php

示例4: template

 function _get_mail_body($template_path)
 {
     $template = new template($template_path);
     $locale =& locale::instance();
     $date = new date();
     $template->set('date', $date->format($locale->get_short_date_format()));
     $cart =& cart::instance();
     $list =& $template->find_child('cart_items');
     $list->register_dataset($cart->get_items_array_dataset());
     $template->set('name', $this->dataspace->get('name'));
     $template->set('notes', $this->dataspace->get('notes'));
     $template->set('phone', $this->dataspace->get('phone'));
     $template->set('address', $this->dataspace->get('address'));
     $template->set('email', $this->dataspace->get('email'));
     ob_start();
     $template->display();
     $content = ob_get_contents();
     ob_end_clean();
     return $content;
 }
开发者ID:BackupTheBerlios,项目名称:limb-svn,代码行数:20,代码来源:checkout_cart_order_action.class.php

示例5: find_bind_topics

 /**
  * Get bind forum topics
  *
  * @param   string  $bind
  * @return  array
  */
 public function find_bind_topics($bind)
 {
     $topics = array();
     switch ($bind) {
         // Upcoming events
         case 'events_upcoming':
             $events = $this->find_upcoming(100);
             break;
             // Past events
         // Past events
         case 'events_past':
             $events = $this->find_past(100);
             break;
     }
     // Build human readable list
     if (!empty($events)) {
         foreach ($events as $event) {
             $topics[$event->id] = $event->name . ' ' . date::format('DDMMYYYY', $event->start_time);
         }
     }
     return $topics;
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:28,代码来源:event.php

示例6: foreach

<?php 
foreach ($galleries as $gallery) {
    ?>
	<li class="unit size1of2">
		<div class="thumb unit size2of5">
			<?php 
    echo html::anchor(url::model($gallery), html::image('http://' . Kohana::config('site.image_server') . '/kuvat/' . $gallery->dir . '/thumb_' . $gallery->default_image->legacy_filename));
    ?>
		</div>
		<header>
			<h4><?php 
    echo html::anchor(url::model($gallery), text::title($gallery->name));
    ?>
</h4>
			<span class="details">
				<?php 
    echo html::time(date::format('DMYYYY', $gallery->event_date), $gallery->event_date, true);
    ?>
,
				<?php 
    echo __2(':images image', ':images images', $gallery->image_count, array(':images' => '<var>' . $gallery->image_count . '</var>'));
    ?>
			</span>
		</header>
	</li>
<?php 
}
?>

</ul>
开发者ID:anqqa,项目名称:Anqh,代码行数:30,代码来源:galleries.php

示例7: foreach

?>

<?php 
if (!empty($events)) {
    ?>
<ul class="events">

	<?php 
    foreach ($events as $event) {
        ?>
	<li class="event event-<?php 
        echo $event->id;
        ?>
">
		<?php 
        echo date::format('DDMM', $event->start_time);
        ?>
		<!--<?php 
        echo html::anchor(url::model($event), text::limit_chars(text::title($event->name), 20, '&hellip;', true), array('title' => $event->name));
        ?>
-->
		<?php 
        echo html::anchor(url::model($event), $event->name);
        ?>
	</li>
	<?php 
    }
    ?>

</ul>
开发者ID:anqqa,项目名称:Anqh,代码行数:30,代码来源:events_list.php

示例8: getYear

 public function getYear()
 {
     return $this->date->format("Y");
 }
开发者ID:rifer,项目名称:cdv,代码行数:4,代码来源:Historical.php

示例9: __

				<dt><?php 
    echo __('Homepage');
    ?>
</dt><dd><?php 
    echo html::anchor($event->homepage);
    ?>
</dd>
				<?php 
}
?>

				<dt><?php 
echo __('Opening hours');
?>
</dt><dd><?php 
echo $event->end_time ? __('From :from to :to', array(':from' => html::time(date::format('HHMM', $event->start_time), $event->start_time), ':to' => html::time(date::format('HHMM', $event->end_time), $event->end_time))) : __('From :from onwards', array(':from' => html::time(date::format('HHMM', $event->start_time), $event->start_time)));
?>
</dd>

				<?php 
if ($event->venue_id) {
    ?>
				<dt><?php 
    echo __('Venue');
    ?>
</dt><dd><?php 
    echo html::anchor(url::model($event->venue), $event->venue->name);
    ?>
, <?php 
    echo html::specialchars($event->venue->city_name);
    ?>
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:event_info.php

示例10: foreach

 * Shouts
 *
 * @package    Anqh
 * @author     Antti Qvickström
 * @copyright  (c) 2010 Antti Qvickström
 * @license    http://www.opensource.org/licenses/mit-license.php MIT license
 */
?>

<ul>
<?php 
foreach ($shouts as $shout) {
    ?>

	<li><?php 
    echo html::time(date::format('HHMM', $shout->created), $shout->created);
    ?>
 <?php 
    echo html::user($shout->author);
    ?>
: <?php 
    echo html::chars($shout->shout);
    ?>
</li>

<?php 
}
?>
</ul>

<?php 
开发者ID:anqqa,项目名称:Anqh,代码行数:31,代码来源:shout.php

示例11: _view

 /**
  * User profile
  */
 public function _view()
 {
     $this->tab_id = 'profile';
     $owner = $this->user && $this->member->id == $this->user->id;
     if ($owner && $this->user->newcomments) {
         $this->user->newcomments = 0;
         $this->user->save();
     }
     // Actions
     if ($this->member->has_access(User_Model::ACCESS_EDIT)) {
         $this->page_actions[] = array('link' => url::user($this->member) . '/edit', 'text' => __('Settings'), 'class' => 'settings');
     }
     // Picture
     widget::add('side', View_Mod::factory('member/member', array('mod_class' => 'member member-' . $this->member->id, 'user' => $this->member)));
     // Comments
     if ($this->member->has_access(User_Model::ACCESS_COMMENT)) {
         $comment = new User_Comment_Model();
         $form_values = $comment->as_array();
         $form_errors = array();
         // check post
         if (csrf::valid() && ($post = $this->input->post())) {
             $comment->user_id = $this->member->id;
             $comment->author_id = $this->user->id;
             $comment->comment = $post['comment'];
             if (isset($post['private'])) {
                 $comment->private = 1;
             }
             try {
                 $comment->save();
                 if (!$owner) {
                     $this->member->newcomments += 1;
                     $this->member->save();
                 }
                 $this->user->commentsleft += 1;
                 $this->user->save();
                 if (!request::is_ajax()) {
                     url::redirect(url::current());
                 }
             } catch (ORM_Validation_Exception $e) {
                 $form_errors = $e->validation->errors();
                 $form_values = arr::overwrite($form_values, $post);
             }
         }
         // Handle pagination
         $per_page = 25;
         $page_num = $this->uri->segment('page') ? $this->uri->segment('page') : 1;
         $page_offset = ($page_num - 1) * $per_page;
         $total_comments = $this->member->get_comment_count();
         $comments = $this->member->find_comments($page_num, $per_page, $this->user);
         $pagination = new Pagination(array('items_per_page' => $per_page, 'total_items' => $total_comments));
         $view = View::factory('generic/comments', array('delete' => '/member/comment/%d/delete/?token=' . csrf::token(), 'private' => '/member/comment/%d/private/?token=' . csrf::token(), 'comments' => $comments, 'errors' => $form_errors, 'values' => $form_values, 'pagination' => $pagination, 'user' => $this->user));
         if (request::is_ajax()) {
             echo $view;
             return;
         }
         widget::add('main', $view);
     }
     // Basic info
     $basic_info = array();
     if (!empty($this->member->name)) {
         $basic_info[__('Name')] = html::specialchars($this->member->name);
     }
     if (!empty($this->member->city_name)) {
         $basic_info[__('City')] = html::specialchars($this->member->city_name);
     }
     if (!empty($this->member->dob) && $this->member->dob != '0000-00-00') {
         $basic_info[__('Date of Birth')] = __(':dob (:years years)', array(':dob' => date::format('DMYYYY', $this->member->dob), ':years' => date::timespan(strtotime($this->member->dob), null, 'years')));
     }
     if (!empty($this->member->gender)) {
         $basic_info[__('Gender')] = $this->member->gender == 'm' ? __('Male') : __('Female');
     }
     if (!empty($this->member->latitude) && !empty($this->member->longitude)) {
         $basic_info[__('Location')] = $this->member->latitude . ', ' . $this->member->longitude;
         $basic_info[__('Location')] = html::anchor('#map', __('Toggle map'), array('class' => 'expander', 'title' => __('Show/hide'))) . '<div id="map" style="display: none">' . __('Map loading') . '</div>';
         $map = new Gmap('map', array('ScrollWheelZoom' => true));
         $map->center($this->member->latitude, $this->member->longitude, 15)->controls('small')->types();
         $map->add_marker($this->member->latitude, $this->member->longitude, html::avatar($this->member->avatar, $this->member->username) . html::user($this->member));
         widget::add('foot', html::script_source($map->render('gmaps/jquery_event')));
         widget::add('foot', html::script_source("\$('a[href*=\"#map\"]:first').click(function() { \$('#map').toggle('normal', gmap_open); return false; });"));
     }
     // Site info
     $site_info = array(__('Registered') => date::format('DMYYYY_HM', $this->member->created) . ' [#' . $this->member->id . ']', __('Logins') => __(':logins (:ago ago)', array(':logins' => number_format($this->member->logins, 0), ':ago' => '<abbr title="' . date::format('DMYYYY_HM', $this->member->last_login) . '">' . date::timespan_short($this->member->last_login) . '</abbr>')), __('Posts') => number_format($this->member->posts, 0), __('Comments') => number_format($this->member->commentsleft, 0));
     // Initialize tabs
     $tabs = array('basic-info' => array('href' => '#basic-info', 'title' => __('Basic info'), 'tab' => new View('generic/list_info', array('id' => 'basic-info', 'title' => __('Basic info'), 'list' => $basic_info))), 'site-info' => array('href' => '#site-info', 'title' => __('Site info'), 'tab' => new View('generic/list_info', array('id' => 'site-info', 'title' => __('Site info'), 'list' => $site_info))));
     widget::add('side', View::factory('generic/tabs', array('id' => 'info-tab', 'tabs' => $tabs)));
     $this->_side_views();
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:90,代码来源:member.php

示例12: __

				<?php 
    }
    ?>
				<?php 
    if ($image->exif->iso) {
        ?>
				<dd><?php 
        echo __('ISO speed: :iso', array(':iso' => '<var>' . text::title($image->exif->iso, true)));
        ?>
</dd>
				<?php 
    }
    ?>
				<?php 
    if ($image->exif->taken) {
        ?>
				<dd><?php 
        echo __('Taken: :taken', array(':taken' => '<var>' . date::format('DMYYYY_HM', $image->exif->taken)));
        ?>
</dd>
				<?php 
    }
    ?>
			<?php 
}
?>

		</dl>
	</div>
</section>
开发者ID:anqqa,项目名称:Anqh,代码行数:30,代码来源:image_info.php

示例13: getDate

 /**
  * Get date
  *
  * @return date 
  */
 public function getDate()
 {
     return $this->date->format('d/m/Y');
 }
开发者ID:rdalambic,项目名称:web-crystal-palace,代码行数:9,代码来源:Actu.php

示例14: getTimeend

 /**
  * Get timeend
  *
  * @return datetime
  */
 public function getTimeend($format = null)
 {
     if (null === $this->timeend || null === $format) {
         return $this->timeend;
     }
     return $this->timeend->format($format);
 }
开发者ID:bmartinezteltek,项目名称:PuMuKIT2,代码行数:12,代码来源:Job.php

示例15: time

 /**
  * Return formatted <time> tag
  *
  * @param  string        $str
  * @param  array|string  $attributes  handled as time if not an array
  * @param  boolean       $short       use only date
  */
 public static function time($str, $attributes = null, $short = false)
 {
     // Extract datetime
     $datetime = is_array($attributes) ? arr::remove('datetime', $attributes) : $attributes;
     if ($datetime) {
         $time = is_int($datetime) ? $datetime : strtotime($datetime);
         $datetime = date::format($short ? date::DATE_8601 : date::TIME_8601, $time);
         if (is_array($attributes)) {
             $attributes['datetime'] = $datetime;
         } else {
             $attributes = array('datetime' => $datetime);
         }
         // Set title if not the same as content
         if (!isset($attributes['title'])) {
             $title = date::format($short ? 'DMYYYY' : 'DMYYYY_HM', $time);
             if ($title != $str) {
                 $attributes['title'] = date::format($short ? 'DMYYYY' : 'DMYYYY_HM', $time);
             }
         }
     }
     return '<time' . html::attributes($attributes) . '>' . $str . '</time>';
 }
开发者ID:anqqa,项目名称:Anqh,代码行数:29,代码来源:MY_html.php


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