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


PHP DateHelper::formatDate方法代码示例

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


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

示例1: getTweets

 public static function getTweets($twitter_user)
 {
     $i = 0;
     $twitter_url = 'http://twitter.com/statuses/user_timeline/' . $twitter_user . '.xml?count=4';
     $tweets = array();
     if ($buffer = @file_get_contents($twitter_url)) {
         libxml_use_internal_errors();
         try {
             $xml = @new \SimpleXMLElement($buffer);
             if ($xml->status) {
                 foreach ($xml->status as $status) {
                     $tweet = $status->text;
                     $date = $status->created_at;
                     $id = $status->id;
                     //Turn all urls, hastags, and @mentions into links
                     $tweet = preg_replace("#(^|[\n ])([\\w]+?://[\\w]+[^ \"\n\r\t< ]*)#", "\\1<a href=\"\\2\">\\2</a>", $tweet);
                     $tweet = preg_replace("#(^|[\n ])((www|ftp)\\.[^ \"\t\n\r< ]*)#", "\\1<a href=\"http://\\2\">\\2</a>", $tweet);
                     $tweet = preg_replace("/@(\\w+)/", "<a href=\"http://twitter.com/\\1\">@\\1</a>", $tweet);
                     $tweet = preg_replace("/#(\\w+)/", "<span class='twitter_hash'><a href=\"http://search.twitter.com/search?q=\\1\">#\\1</a></span>", $tweet);
                     $formatted_date = DateHelper::formatDate($date);
                     $tweets[$i]['tweet'] = $tweet;
                     $tweets[$i]['date'] = $formatted_date;
                     $i++;
                 }
             }
         } catch (\Exception $e) {
         }
     }
     return $tweets;
 }
开发者ID:houzhenggang,项目名称:cobalt,代码行数:30,代码来源:TweetsHelper.php

示例2: testFormatDates

 public function testFormatDates()
 {
     Localization::changeLocale('en_US');
     $activeUser = User::isLoggedIn() ? new User() : null;
     if ($activeUser) {
         $activeUser->logout();
     }
     $timestamp = time();
     $this->assertEquals($this->object->date(DATE_APP_GENERIC_MDY, $timestamp), $this->object->formatDate($timestamp, false));
     $this->assertEquals($this->object->date(DATE_APP_GENERIC_MDY_FULL, $timestamp), $this->object->formatDate($timestamp, true));
     $this->assertEquals($this->object->date(DATE_APP_GENERIC_T, $timestamp), $this->object->formatTime($timestamp, false));
     $this->assertEquals($this->object->date(DATE_APP_GENERIC_TS, $timestamp), $this->object->formatTime($timestamp, true));
     $this->assertEquals($this->object->date(DATE_APP_GENERIC_MDYT, $timestamp), $this->object->formatDateTime($timestamp, false, false));
     /*
     $this->assertEquals(
     	$this->object->date(, $timestamp),
     	$this->object->formatDateTime($timestamp, false, true)
     );
     */
     $this->assertEquals($this->object->date(DATE_APP_GENERIC_MDYT_FULL, $timestamp), $this->object->formatDateTime($timestamp, true, false));
     $this->assertEquals($this->object->date(DATE_APP_GENERIC_MDYT_FULL_SECONDS, $timestamp), $this->object->formatDateTime($timestamp, true, true));
     if ($activeUser) {
         User::getByUserID($activeUser->getUserID(), true);
     }
 }
开发者ID:ojalehto,项目名称:concrete5-legacy,代码行数:25,代码来源:DateHelperTest.php

示例3: formatTourDate

 public static function formatTourDate($str, $glue)
 {
     $date = explode(',', $str);
     $result = array();
     for ($i = 0; $i < count($date); $i++) {
         $result[] = DateHelper::formatDate($date[$i]);
     }
     return implode($glue, $result);
 }
开发者ID:hixbotay,项目名称:executivetransport,代码行数:9,代码来源:string.php

示例4: testTimeSince

 public function testTimeSince()
 {
     Localization::changeLocale("en_US");
     $minutes = 60;
     $hours = $minutes * 60;
     $days = $hours * 24;
     // time is in the future
     $future = time() + 7;
     $this->assertEquals($this->object->formatDate($future), $this->object->timeSince($future));
     // time is now
     $this->assertEquals("0 seconds", $this->object->timeSince(time()));
     // time is in the past
     $this->assertEquals("7 seconds", $this->object->timeSince(time() - 7));
     $this->assertEquals("3 minutes", $this->object->timeSince(time() - (3 * $minutes + 13)));
     $this->assertEquals("3 minutes, 13 seconds", $this->object->timeSince(time() - (3 * $minutes + 13), 1));
     $this->assertEquals("4 hours", $this->object->timeSince(time() - (4 * $hours + 2 * $minutes)));
     $this->assertEquals("4 hours, 1 minute", $this->object->timeSince(time() - (4 * $hours + 1 * $minutes), 1));
     $this->assertEquals("1 day", $this->object->timeSince(time() - (1 * $days + 1 * $minutes)));
     $this->assertEquals("2 days, 2 hours", $this->object->timeSince(time() - (2 * $days + 2 * $hours), 1));
     $this->assertEquals('145 days', $this->object->timeSince(time() - 145 * $days));
     $this->assertEquals($this->object->formatDate(time() - 367 * $days), $this->object->timeSince(time() - 367 * $days));
 }
开发者ID:ceko,项目名称:concrete5-1,代码行数:22,代码来源:DateHelperTest.php

示例5: count

</th>
            <th><?php 
echo TextHelper::_('COBALT_PEOPLE_CONTACT');
?>
</th>
            <?php 
$c = count($company['people']);
for ($i = 0; $i < $c; $i++) {
    $person = $company['people'][$i];
    $k = $i % 2;
    echo '<tr class="cobalt_row_' . $k . '">';
    if (array_key_exists('avatar', $person) && $person['avatar'] != "") {
        echo '<td><img src="' . JURI::base() . 'src/Cobalt/media/avatars/' . $person['avatar'] . '"/></td>';
    } else {
        echo '<td><img src="' . JURI::base() . 'src/Cobalt/media/images/person.png' . '"/></td>';
    }
    echo '<td>' . $person['last_name'] . ', ' . $person['first_name'] . '</td>';
    echo '<td>' . $person['phone'] . '</td>';
    echo '<td>' . $person['owner_first_name'] . ' ' . $person['owner_last_name'] . '</td>';
    echo '<td>' . ucwords($person['type']) . '</td>';
    echo '<td>' . DateHelper::formatDate($person['modified']) . '</td>';
    echo '</tr>';
}
?>
        </table>
    </div>

</div>
</div>
</div>
开发者ID:houzhenggang,项目名称:cobalt,代码行数:30,代码来源:company.php

示例6: Copyright

<?php

/*------------------------------------------------------------------------
# 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');
$c = count($this->notes);
for ($i = 0; $i < $c; $i++) {
    $note = $this->notes[$i];
    echo '<li>';
    echo '<div class="ui-li-aside"><b>' . DateHelper::formatDate($note['created']) . '</b></div>';
    echo '<h3 class="ui-li-heading"><b>' . $note['owner_first_name'] . ' ' . $note['owner_last_name'] . '</b></h3>';
    echo '<p class="ui-li-desc">' . $note['note'] . '</p>';
    echo '</li>';
}
开发者ID:houzhenggang,项目名称:cobalt,代码行数:21,代码来源:default.mobile.php

示例7: isset

" />
                    </div>
                    <?php 
                break;
            case "date":
                ?>
                    <!-- make this a custom date picker -->
                    <div class="input-append">
                        <input id="custom_<?php 
                echo isset($value['id']) ? $value['id'] : '';
                ?>
" name="custom_<?php 
                echo isset($value['id']) ? $value['id'] : '';
                ?>
_input" class="form-control filter_input date_input" type="text" value="<?php 
                echo DateHelper::formatDate($custom_field_filter);
                ?>
"  />
                        <input id="custom_<?php 
                echo isset($value['id']) ? $value['id'] : '';
                ?>
_hidden" name="custom_<?php 
                echo isset($value['id']) ? $value['id'] : '';
                ?>
" type="hidden" value="<?php 
                echo $custom_field_filter;
                ?>
" />
                        <span class="input-append-addon"><i class="glyphicon glyphicon-calendar"></i></span>
                    </div>
                    <?php 
开发者ID:houzhenggang,项目名称:cobalt,代码行数:31,代码来源:edit.php

示例8:

                <select class="form-control" name="category_id">
                    <?php 
$categories = NoteHelper::getCategories();
echo JHtml::_('select.options', $categories, 'value', 'text', $note['category_id'], true);
?>
                </select>
            </div>
        </div>
        <div class="cobaltRow">
            <div class="cobaltField"><?php 
echo TextHelper::_('COBALT_CREATED_ON');
?>
</div>
            <div class="cobaltValue">
                <span class="date"><?php 
echo DateHelper::formatDate($note['created']) . ' ' . DateHelper::formatTime($note['created']);
?>
</span>
            </div>
        </div>
        <div class="cobaltRow">
            <div class="cobaltField"><?php 
echo TextHelper::_('COBALT_CONTENT');
?>
</div>
            <div class="cobaltValue">
                <textarea class="form-control" name="note"><?php 
echo $note['note'];
?>
</textarea>
            </div>
开发者ID:houzhenggang,项目名称:cobalt,代码行数:31,代码来源:edit.php

示例9: ucwords

echo RouteHelper::_('index.php?view=events&layout=edit_task');
?>
" data-icon="plus" class="ui-btn-right">
                <?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'];
开发者ID:houzhenggang,项目名称:cobalt,代码行数:31,代码来源:default.mobile.php

示例10:

    echo $k;
    ?>
">
        <td><a href="<?php 
    echo RouteHelper::_('index.php?view=reports&layout=custom_report&id=' . $report['id']);
    ?>
"><?php 
    echo $report['name'];
    ?>
</a></td>
        <td><?php 
    echo DateHelper::formatDate($report['modified']);
    ?>
</td>
        <td><?php 
    echo DateHelper::formatDate($report['created']);
    ?>
</td>
        <td>
            <a href="<?php 
    echo RouteHelper::_('index.php?view=reports&layout=edit_custom_report&id=' . $report['id']);
    ?>
"><?php 
    echo TextHelper::_('COBALT_EDIT_BUTTON');
    ?>
</a>
            |
            <a href="javascript:void(0);" class="delete delete_custom_report"><i class="glyphicon glyphicon-trash"></i></a>
        </td>
    </tr>
<?php 
开发者ID:houzhenggang,项目名称:cobalt,代码行数:31,代码来源:custom_reports_filter.php

示例11:

}
?>
                    <span <?php 
echo $hidden;
?>
 class="end_date"><?php 
echo TextHelper::_('COBALT_END_DATE_MESSAGE');
?>
</span>
                    <div <?php 
echo $show;
?>
 id="end_date">
                        <input id="end_date_input" class="form-control date_input" type="text" name="end_date_input" value="<?php 
if (array_key_exists('end_date', $event)) {
    echo DateHelper::formatDate($event['end_date']);
}
?>
" />
                        <input id="end_date_input_hidden" name="end_date" type="hidden" value="<?php 
if (array_key_exists('end_date', $event)) {
    echo $event['end_date'];
}
?>
" />
                    </div>
            </div>
        </div>
        <div class="cobaltRow">
             <div class="cobaltField"><?php 
echo TextHelper::_('COBALT_EDIT_TASK_REPEAT');
开发者ID:houzhenggang,项目名称:cobalt,代码行数:31,代码来源:edit_task.php

示例12:

    if ($note['deal_id'] != null and $note['deal_id'] != 0) {
        echo '<a href="' . RouteHelper::_('index.php?view=deals&layout=deal&id=' . $note['deal_id']) . '">' . $note['deal_name'] . '</a>';
    }
    ?>
         </td>
         <td>
             <?php 
    if ($note['person_id'] != null and $note['person_id'] != 0) {
        echo '<a href="' . RouteHelper::_('index.php?view=people&layout=person&id=' . $note['person_id']) . '">' . $note['person_first_name'] . ' ' . $note['person_last_name'] . '</a>';
    }
    ?>
         </td>
         <td><?php 
    echo $note['owner_first_name'] . " " . $note['owner_last_name'];
    ?>
</td>
         <td><?php 
    echo DateHelper::formatDate($note['created']);
    ?>
</td>
         <td><?php 
    echo $note['category_name'];
    ?>
</td>
         <td><?php 
    echo $note['note'];
    ?>
</td>
     </tr>
<?php 
}
开发者ID:houzhenggang,项目名称:cobalt,代码行数:31,代码来源:notes_filter.php

示例13: affiliates_admin_hits_affiliate


//.........这里部分代码省略.........
							<th scope="col" class="affiliate-id">' . __('Affiliate', AFFILIATES_PLUGIN_DOMAIN) . '</th>
							</tr>
							</thead>
							<tbody>
							';
                        foreach ($referrals as $referral) {
                            $output .= '<tr class="details-referrals ' . ($i % 2 == 0 ? 'even' : 'odd') . '">';
                            $output .= "<td class='datetime'>" . DateHelper::s2u($referral->datetime) . "</td>";
                            $link = get_permalink($referral->post_id);
                            $title = get_the_title($referral->post_id);
                            $output .= '<td class="post-id"><a href="' . esc_attr($link) . '" target="_blank">' . stripslashes(wp_filter_nohtml_kses($title)) . '</a></td>';
                            $output .= "<td class='affiliate-id'>" . stripslashes(wp_filter_nohtml_kses($referral->name)) . "</td>";
                            $output .= '</tr>';
                        }
                        $output .= '</tbody></table>';
                        $output .= '</div>';
                        // .details-referrals
                        $output .= '</td></tr>';
                    }
                }
                // if $expanded_referrals
                //
                // expanded : hits ----------------------------------------
                //
                if ($expanded_hits) {
                    // get the detailed results for hits
                    $details_orderby = "date {$order}, time {$order}";
                    $details_filters = " WHERE h.affiliate_id = %d ";
                    $details_filter_params = array($result->affiliate_id);
                    if ($from_date && $thru_date) {
                        $details_filters .= " AND datetime >= %s AND datetime < %s ";
                        $details_filter_params[] = $from_datetime;
                        $details_filter_params[] = $thru_datetime;
                    } else {
                        if ($from_date) {
                            $details_filters .= " AND datetime >= %s ";
                            $details_filter_params[] = $from_datetime;
                        } else {
                            if ($thru_date) {
                                $details_filters .= " datetime < %s ";
                                $details_filter_params[] = $thru_datetime;
                            }
                        }
                    }
                    $details_query = $wpdb->prepare("SELECT *\n\t\t\t\t\t\tFROM {$hits_table} h\n\t\t\t\t\t\tLEFT JOIN {$affiliates_table} a ON h.affiliate_id = a.affiliate_id\n\t\t\t\t\t\t{$details_filters}\n\t\t\t\t\t\tORDER BY {$details_orderby}\n\t\t\t\t\t\t", $details_filter_params);
                    $hits = $wpdb->get_results($details_query, OBJECT);
                    $output .= '<tr class=" ' . ($i % 2 == 0 ? 'even' : 'odd') . '">';
                    $output .= '<td colspan="5">';
                    $output .= '<div class="details-hits">';
                    $output .= '<p class="description">' . __('Hits', AFFILIATES_PLUGIN_DOMAIN) . '</p>';
                    $output .= '
						<table id="details-hits-' . esc_attr($result->date) . '" class="details-hits" cellspacing="0">
						<thead>
						<tr>
						<th scope="col" class="date">' . __('Date', AFFILIATES_PLUGIN_DOMAIN) . '</th>
						<th scope="col" class="time">' . __('Time', AFFILIATES_PLUGIN_DOMAIN) . '</th>
						<th scope="col" class="ip">' . __('IP', AFFILIATES_PLUGIN_DOMAIN) . '</th>
						<th scope="col" class="count">' . __('Count', AFFILIATES_PLUGIN_DOMAIN) . '</th>
						<th scope="col" class="affiliate-id">' . __('Affiliate', AFFILIATES_PLUGIN_DOMAIN) . '</th>
						</tr>
						</thead>
						<tbody>
						';
                    foreach ($hits as $hit) {
                        $output .= '<tr class="details ' . ($i % 2 == 0 ? 'even' : 'odd') . '">';
                        //						$output .= "<td class='date'>$hit->date</td>";
                        $output .= '<td class="date">' . DateHelper::formatDate(DateHelper::s2u($hit->datetime)) . '</td>';
                        //						$output .= "<td class='time'>$hit->time</td>";
                        $output .= '<td class="time">' . DateHelper::formatTime(DateHelper::s2u($hit->datetime)) . '</td>';
                        $output .= "<td class='ip'>" . long2ip($hit->ip) . "</td>";
                        $output .= "<td class='count'>{$hit->count}</td>";
                        $output .= "<td class='affiliate-id'>" . stripslashes(wp_filter_nohtml_kses($hit->name)) . "</td>";
                        $output .= '</tr>';
                    }
                    $output .= '</tbody></table>';
                    $output .= '</div>';
                    // .details-hits
                    $output .= '</td></tr>';
                }
                // if $expanded_hits
            }
            // expanded
        }
    } else {
        $output .= '<tr><td colspan="5">' . __('There are no results.', AFFILIATES_PLUGIN_DOMAIN) . '</td></tr>';
    }
    $output .= '</tbody>';
    $output .= '</table>';
    if ($paginate) {
        require_once AFFILIATES_CORE_LIB . '/class-affiliates-pagination.php';
        $pagination = new Affiliates_Pagination($count, null, $row_count);
        $output .= '<div class="tablenav bottom">';
        $output .= $pagination->pagination('bottom');
        $output .= '</div>';
    }
    $output .= '</div>';
    // .visits-overview
    echo $output;
    affiliates_footer();
}
开发者ID:mahassan,项目名称:shellneverknow,代码行数:101,代码来源:affiliates-admin-hits-affiliate.php

示例14: fillTOURInfo

 private function fillTOURInfo($input)
 {
     AImporter::model('tour', 'orderinfos', 'passengers');
     AImporter::helper('tour', 'date', 'bookpro', 'image');
     $duration = TourHelper::buildDuration($this->orderComplex->tour);
     $input = str_replace('{duration}', $duration, $input);
     $input = str_replace('{tour_name}', $this->orderComplex->tour->title, $input);
     $input = str_replace('{tour_number}', $this->orderComplex->tour->code, $input);
     $input = str_replace('{depart}', DateHelper::formatDate($this->orderComplex->tour->start), $input);
     if ($this->orderComplex->tour->type = "TOUR") {
         $customfield = BookProHelper::renderLayout('tour', $this->orderComplex->tour);
         $input = str_replace('{infosummary}', $customfield, $input);
         $layout = new JLayoutFile('addons', $basePath = JPATH_ROOT . '/components/com_bookpro/layouts');
         $html = $layout->render($this->orderComplex);
         $input = str_replace('{addons}', $html, $input);
         $layout = new JLayoutFile('passengers', $basePath = JPATH_ROOT . '/components/com_bookpro/layouts');
         $html = $layout->render($this->orderComplex->passengers);
         $input = str_replace('{passengers}', $html, $input);
     } elseif ($this->orderComplex->tour->type = "TOUR_INQUIRY") {
         $customfield = BookProHelper::renderLayout('customfieldvalue', $this->order->id);
         $input = str_replace('{customfields}', $customfield, $input);
         $customfield = BookProHelper::renderLayout('tour', $this->orderComplex);
         $input = str_replace('{infosummary}', $customfield, $input);
     }
     return $input;
 }
开发者ID:hixbotay,项目名称:executivetransport,代码行数:26,代码来源:email.php

示例15: ucwords

    echo '<td>' . $person['phone'] . '</td>';
    echo '<td>' . $person['owner_first_name'] . ' ' . $person['owner_last_name'] . '</td>';
    echo '<td>' . ucwords($person['type']) . '</td>';
    echo '<td>' . DateHelper::formatDate($person['modified']) . '</td>';
    echo '</tr>';
}
?>
        </table>

    </div>

    <h2><?php 
echo TextHelper::_('COBALT_EDIT_CONVERSATIONS');
?>
</h2>

    <div id="conversation_entries">
    <?php 
$c = count($deal->conversations);
for ($i = 0; $i < $c; $i++) {
    $convo = $deal->conversations[$i];
    echo '<div class="conversation">';
    echo '<div class="header"><b>' . DateHelper::formatDate($convo['created']) . '</b></div>';
    echo '<div class="convo_info"><b>' . TextHelper::_('COBALT_USER') . '</b> ' . TextHelper::_('COBALT_WROTE') . ':</div>';
    echo '<div class="convo">' . $convo['conversation'] . '</div>';
    echo '</div>';
}
?>
</div>
</div>
开发者ID:houzhenggang,项目名称:cobalt,代码行数:30,代码来源:deal.php


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