當前位置: 首頁>>代碼示例>>PHP>>正文


PHP DateHelper::getRelativeDate方法代碼示例

本文整理匯總了PHP中DateHelper::getRelativeDate方法的典型用法代碼示例。如果您正苦於以下問題:PHP DateHelper::getRelativeDate方法的具體用法?PHP DateHelper::getRelativeDate怎麽用?PHP DateHelper::getRelativeDate使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在DateHelper的用法示例。


在下文中一共展示了DateHelper::getRelativeDate方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: Copyright

# Cobalt
# ------------------------------------------------------------------------
# @author Cobalt
# @copyright Copyright (C) 2012 cobaltcrm.org All Rights Reserved.
# @license - http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL
# Website: http://www.cobaltcrm.org
-------------------------------------------------------------------------*/
// no direct access
defined('_CEXEC') or die('Restricted access');
$current_heading = "";
if (count($this->events) > 0) {
    foreach ($this->events as $event) {
        $display_date = $event['type'] == "event" ? $event['start_time'] . " " . $event['start_time_hour'] : $event['due_date'] . " " . $event['due_date_hour'];
        $time = $event['type'] == "event" ? $event['start_time_hour'] : $event['due_date_hour'];
        $display_date = $display_date == "" ? TextHelper::_('COBALT_NA') : DateHelper::formatDate($display_date, false, false);
        $relative_date_title = DateHelper::getRelativeDate($display_date);
        if ($event['completed'] == 1) {
            $completed = "line-through";
        } else {
            $completed = "";
        }
        if ($current_heading != $relative_date_title) {
            if ($current_heading != "") {
                echo '</table>';
            }
            echo '<h4>' . $relative_date_title . '</h4>';
            $current_heading = $relative_date_title;
            echo '<table class="table table-striped table-hover">';
        }
        echo '<tr class="com_crmery_task_event" id="com_crmery_listing_' . $event['id'] . '">';
        echo '<td><input type="checkbox" class="event_list_checkbox" name="item_id[' . $event['id'] . ']" /></td>';
開發者ID:houzhenggang,項目名稱:cobalt,代碼行數:31,代碼來源:event_listings.php

示例2: ucwords

                <?php 
echo ucwords(TextHelper::_('COBALT_ADD_TASK'));
?>
            </a>
    </div>

    <div data-role="content">
        <ul class="ui-listview" data-role="listview" data-filter="true" data-autodividers="true" data-theme="c">
            <?php 
$n = count($this->events);
for ($i = 0; $i < $n; $i++) {
    $event = $this->events[$i];
    $event_date = DateHelper::formatDate($event['due_date']);
    $k = $i % 2;
    if ($i == 0 || substr_compare($event['due_date'], $this->events[$i - 1]['due_date'], 0)) {
        echo "<li data-role='list-divider'>" . DateHelper::getRelativeDate($event_date) . " " . $event_date . "</li>";
    }
    ?>
                    <li data-filtertext="<?php 
    echo $event['name'];
    ?>
">
                        <a href="<?php 
    echo RouteHelper::_('index.php?view=events&layout=event&id=' . $event['id']);
    ?>
">
                            <h3 class="ui-li-heading"><?php 
    echo $event['name'];
    ?>
</h3>
                            <p class="ui-li-desc"><?php 
開發者ID:houzhenggang,項目名稱:cobalt,代碼行數:31,代碼來源:default.mobile.php


注:本文中的DateHelper::getRelativeDate方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。