本文整理汇总了PHP中DateHelper::formatTime方法的典型用法代码示例。如果您正苦于以下问题:PHP DateHelper::formatTime方法的具体用法?PHP DateHelper::formatTime怎么用?PHP DateHelper::formatTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DateHelper
的用法示例。
在下文中一共展示了DateHelper::formatTime方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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);
}
}
示例2: 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();
}
示例3: switch
if ($event['type'] == "task") {
echo '<input type="hidden" name="due_date" value="' . $event['due_date'] . '" />';
} else {
echo '<input type="hidden" name="start_time" value="' . $event['start_time'] . '" />';
echo '<input type="hidden" name="end_time" value="' . $event['end_time'] . '" />';
}
echo '<input type="hidden" name="event_type" value="' . $event['type'] . '" />';
echo '<input type="hidden" name="repeats" value="' . $event['repeats'] . '" />';
echo '<input type="hidden" name="type" value="single" />';
echo '</div>';
echo '</td>';
$display_date = $event['type'] == "event" ? $event['start_time'] : $event['due_date'];
if ($display_date == "") {
$display_date = TextHelper::_('COBALT_NA');
}
echo '<td class="date"><small>' . DateHelper::formatDateString($display_date) . ' ' . DateHelper::formatTime($time, "(" . UsersHelper::getTimeFormat() . ")") . '</small></td>';
switch ($event['association_type']) {
case "company":
echo "<td><i class='glyphicon glyphicon-briefcase'></i> <a href='" . RouteHelper::_('index.php?view=companies&layout=company&id=' . $event['company_id']) . "'>" . $event['company_name'] . "</a></td>";
break;
case "deal":
echo "<td><i class='glyphicon glyphicon-tag'></i> <a href='" . RouteHelper::_('index.php?view=deals&layout=deal&id=' . $event['deal_id']) . "'>" . $event['deal_name'] . "</a></td>";
break;
case "person":
echo "<td><i class='glyphicon glyphicon-user'></i> <a href='" . RouteHelper::_('index.php?view=people&layout=person&id=' . $event['person_id']) . "'>" . $event['person_first_name'] . " " . $event['person_last_name'] . "</a></td>";
break;
default:
echo "<td> </td>";
break;
}
echo '</tr>';
示例4:
<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>
示例5: ucwords
echo $event['name'];
echo '</a>';
echo '<ul class="dropdown-menu" role="menu" aria-labelledby="event_menu_' . $event['id'] . '_link">';
if ($event['completed'] == 1) {
echo '<li><a href="javascript:void(0);" onclick="Calendar.markEventIncomplete(this)" >' . TextHelper::_('COBALT_MARK_INCOMPLETE') . '</a></li>';
} else {
echo '<li><a href="javascript:void(0);" onclick="Calendar.markEventComplete(this)" >' . TextHelper::_('COBALT_MARK_COMPLETE') . '</a></li>';
echo '<li><a href="javascript:void(0);" onclick="Calendar.postponeEvent(this,1)" >' . TextHelper::_('COBALT_POSTPONE_1_DAY') . '</a></li>';
echo '<li><a href="javascript:void(0);" onclick="Calendar.postponeEvent(this,7)" >' . TextHelper::_('COBALT_POSTPONE_7_DAYS') . '</a></li>';
}
$id = (array_key_exists('parent_id', $event) && $event['parent_id']) != 0 ? $event['parent_id'] : $event['id'];
echo '<li><a href="javascript:void(0);" onclick="Calendar.editEvent(' . $id . ',\'' . $event['type'] . '\')" >' . TextHelper::_('COBALT_EDIT') . '</a></li>';
echo '<li><a href="javascript:void(0);" onclick="Calendar.removeCalendarEvent(this)" >' . TextHelper::_('COBALT_DELETE') . '</a></li>';
echo '</ul>';
echo '</div></td>';
echo '<td class="due_date_column">' . $due_date . ' ' . DateHelper::formatTime($time, "(" . UsersHelper::getTimeFormat() . ")") . '</td>';
echo '<td>';
if ($event['deal_name']) {
echo '<a href=' . RouteHelper::_('index.php?view=deals&layout=deal&id=' . $event['deal_id']) . '>' . $event['deal_name'] . '</a><br />';
}
if ($event['company_name']) {
echo '<a href=' . RouteHelper::_('index.php?view=companies&layout=company&id=' . $event['company_id']) . '>' . $event['company_name'] . '</a>';
}
if ($event['person_id']) {
echo '<a href=' . RouteHelper::_('index.php?view=people&layout=person&id=' . $event['person_id']) . '>' . $event['person_first_name'] . ' ' . $event['person_last_name'] . '</a>';
}
echo '</td>';
echo '<td>' . $event['owner_first_name'] . ' ' . $event['owner_last_name'] . '</td>';
echo '<td>' . $event['assignee_first_name'] . ' ' . $event['assignee_last_name'] . '</td>';
echo '<td>' . ucwords($event['category_name']) . '</td>';
echo '<td class="contacts" ><a href="javascript:void(0);" onclick="Calendar.showEventContactsDialogModal(' . $event['id'] . ');"><img src="' . JURI::base() . 'src/Cobalt/media/images/card.png' . '"/></a></td>';