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


PHP time_diff函数代码示例

本文整理汇总了PHP中time_diff函数的典型用法代码示例。如果您正苦于以下问题:PHP time_diff函数的具体用法?PHP time_diff怎么用?PHP time_diff使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: reader_g

function reader_g($user_num, $day)
{
    $conect = connect_acc();
    $list = new linked_day();
    if ($result = $conect->query("SELECT * FROM `Event` WHERE `USER_#`='{$user_num}' AND `DAY`='{$day}' ORDER BY 'PRIORTY' ASC")) {
        if ($result->num_rows > 0) {
            while ($row = $result->fetch_assoc()) {
                $time_s = explode(' ', $row['TIME_BEGIN']);
                $time_e = explode(' ', $row['TIME_END']);
                $time_bs = $row['BUFF_BEGIN'];
                $time_be = $row['BUFF_END'];
                if (($buf_time_b = time_diff($time_bs, $time_s[1])) <= $time_s[1]) {
                    $list->add("free time", $buf_time_b, $time_s[1]);
                } else {
                    $list->add("free time", "00:00:00", $time_s[1]);
                }
                $list->add($row['EVENT_NAME'], $time_s[1], $time_e[1]);
                if (($buf_time_a = time_add($time_be, $time_e[1])) >= $time_e[1]) {
                    $list->add("free time", $time_e[1], $buf_time_a);
                } else {
                    $list->add("free time", $time_e[1], "23:59:59");
                }
            }
        }
    }
    disconnect($conect);
    return $list;
}
开发者ID:TylerCreatingThings,项目名称:Priority-Project,代码行数:28,代码来源:algorithm.php

示例2: make_staff_row

/**
 * Generate a table row for a staff member on staff.php
 *
 * @param $Row used for alternating row colors
 * @param $ID the user ID of the staff member
 * @param $Paranoia the user's paranoia
 * @param $Class the user class
 * @param $LastAccess datetime the user last browsed the site
 * @param $Remark the "Staff remark" or FLS' "Support for" text
 * @param $HiddenBy the text that is displayed when a staff member's
 *                  paranoia hides their LastAccess time
 * @return string $Row
 */
function make_staff_row($Row, $ID, $Paranoia, $Class, $LastAccess, $Remark = '', $HiddenBy = 'Hidden by user')
{
    $Row = $Row === 'a' ? 'b' : 'a';
    echo "\t\t\t<tr class=\"row{$Row}\">\n\t\t\t\t<td class=\"nobr\">\n\t\t\t\t\t" . Users::format_username($ID, false, false, false) . "\n\t\t\t\t</td>\n\t\t\t\t<td class=\"nobr\">\n\t\t\t\t\t";
    //used for proper indentation of HTML
    if (check_paranoia('lastseen', $Paranoia, $Class)) {
        echo time_diff($LastAccess);
    } else {
        echo "{$HiddenBy}";
    }
    echo "\n\t\t\t\t</td>\n\t\t\t\t<td class=\"nobr\">" . Text::full_format($Remark) . "</td>\n\t\t\t</tr>\n";
    // the "\n" is needed for pretty HTML
    // the foreach loop that calls this function needs to know the new value of $Row
    return $Row;
}
开发者ID:karamanolev,项目名称:Gazelle,代码行数:28,代码来源:functions.php

示例3: while

<div class="thin">
	<h2><?php 
echo $Subject;
?>
</h2>
	<div class="linkbox">
		<a href="inbox.php">[Back to inbox]</a>
	</div>
<? while(list($SentDate, $SenderID, $Body, $MessageID) = $DB->next_record()) { ?>
	<div class="box vertical_space">
		<div class="head">
			By <strong><?php 
echo $Users[$SenderID]['UserStr'];
?>
</strong> <?php 
echo time_diff($SentDate);
?>
 - <a href="#quickpost" onclick="Quote('<?php 
echo $MessageID;
?>
','<?php 
echo $Users[$SenderID]['Username'];
?>
');">[Quote]</a>	
		</div>
		<div class="body" id="message<?php 
echo $MessageID;
?>
"><?php 
echo $Text->full_format($Body);
?>
开发者ID:4play,项目名称:gazelle2,代码行数:31,代码来源:conversation.php

示例4: foreach

    $DB->query("\n\t\tUPDATE users_info\n\t\tSET LastReadBlog = '" . $Blog[0][0] . "'\n\t\tWHERE UserID = " . $LoggedUser['ID']);
    $LoggedUser['LastReadBlog'] = $Blog[0][0];
}
foreach ($Blog as $BlogItem) {
    list($BlogID, $Author, $AuthorID, $Title, $Body, $BlogTime, $ThreadID) = $BlogItem;
    ?>
	<div id="blog<?php 
    echo $BlogID;
    ?>
" class="box blog_post">
		<div class="head">
			<strong><?php 
    echo $Title;
    ?>
</strong> - posted <?php 
    echo time_diff($BlogTime);
    ?>
 by <a href="user.php?id=<?php 
    echo $AuthorID;
    ?>
"><?php 
    echo $Author;
    ?>
</a>
<?php 
    if (check_perms('admin_manage_blog')) {
        ?>
			- <a href="blog.php?action=editblog&amp;id=<?php 
        echo $BlogID;
        ?>
" class="brackets">Edit</a>
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:index.php

示例5: display

        ?>
</p>
                                                <p class="article-edit-nav"></p>
                                            </td>
                                            <?php 
        if ($category == 'ing_executives') {
            ?>
                                            <td><p><?php 
            display($members_item->position);
            ?>
</p></td>
                                            <?php 
        }
        ?>
                                            <td><p><?php 
        $time = time_diff($members_item->approved_date, TRUE);
        if ($time == 'just now') {
            display('Just now');
        } elseif (strpos($time, '1 day') !== FALSE) {
            display('Yesterday');
        } elseif (strpos($time, 'second') !== FALSE or strpos($time, 'minute') !== FALSE or strpos($time, 'hour') !== FALSE or strpos($time, 'day') !== FALSE) {
            display($time . ' ago');
        } else {
            display($members_item->approved_date);
        }
        ?>
</p></td>
                                            <td><p><?php 
        display($members_item->approved_by);
        ?>
</p></td>
开发者ID:puncoz,项目名称:ingnepal.org,代码行数:31,代码来源:member_manage.php

示例6: foreach

    die;
}
Text::$TOC = true;
$UserID = (int) $_GET['userid'];
$UserIDSQL = "";
if (!empty($UserID)) {
    $UserIDSQL = " AND UserID != '{$UserID}' ";
}
G::$DB->query("\n\t\tSELECT UserID, Answer, Date\n\t\tFROM staff_answers\n\t\tWHERE QuestionID = '{$ID}'\n\t\t\t{$UserIDSQL}\n\t\tORDER BY DATE DESC");
$Answers = G::$DB->to_array(false, MYSQLI_ASSOC);
foreach ($Answers as $Answer) {
    ?>
	<div class="box box2">
		<div class="head">
			<span>
				Answer by <?php 
    echo Users::format_username($Answer['UserID']);
    ?>
 - <?php 
    echo time_diff($Answer['Date']);
    ?>
			</span>
		</div>
		<div class="pad">
<?php 
    echo Text::full_format($Answer['Answer']);
    ?>
		</div>
	</div>
<?php 
}
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:ajax_get_answers.php

示例7: time_diff

            echo $LastRead[$TopicID]['Page'];
            ?>
#post<?php 
            echo $LastRead[$TopicID]['PostID'];
            ?>
"></a>
			</span>
<?php 
        }
        ?>
			<span style="float: right;" class="last_poster">
				by <?php 
        echo Users::format_username($LastAuthorID, false, false, false, false, false, $IsDonorForum);
        ?>
 <?php 
        echo time_diff($LastTime, 1);
        ?>
			</span>
		</td>
		<td class="number_column"><?php 
        echo number_format($PostCount - 1);
        ?>
</td>
		<td><?php 
        echo Users::format_username($AuthorID, false, false, false, false, false, $IsDonorForum);
        ?>
</td>
	</tr>
<?php 
    }
}
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:forum.php

示例8: foreach

    echo $LoggedUser['AuthKey'];
    ?>
" />
		<input type="hidden" name="topicid" value="<?php 
    echo $ThreadID;
    ?>
" />
		<table cellpadding="6" cellspacing="1" border="0" width="100%" class="layout border hidden" id="thread_notes_table">
<?php 
    foreach ($Notes as $Note) {
        ?>
			<tr><td><?php 
        echo Users::format_username($Note['AuthorID']);
        ?>
 (<?php 
        echo time_diff($Note['AddedTime'], 2, true, true);
        ?>
)</td><td><?php 
        echo Text::full_format($Note['Body']);
        ?>
</td></tr>
<?php 
    }
    ?>
			<tr>
				<td colspan="2" class="center">
					<div class="field_div textarea_wrap"><textarea id="topic_notes" name="body" cols="90" rows="3" onkeyup="resize('threadnotes');" style=" margin: 0px; width: 735px;"></textarea></div>
					<input type="submit" value="Save" />
				</td>
			</tr>
		</table>
开发者ID:mohirt,项目名称:Gazelle,代码行数:31,代码来源:thread.php

示例9: format_username

?>
	<tr>
		<td><?php 
echo format_username($UserID, $Username, $Donor, $Warned, $Enabled, $PermissionID);
?>
</td>
		<td><?php 
echo PAYPAL_SYMBOL;
?>
 <?php 
echo display_str($Amount);
?>
</td>
		<td><?php 
echo display_str($Email);
?>
</td>
		<td><?php 
echo time_diff($DonationTime);
?>
</td>
	</tr>
<?	} ?>
</table>
<div class="linkbox">
	<?php 
echo $Pages;
?>
</div>
<? show_footer(); ?>
开发者ID:4play,项目名称:gazelle2,代码行数:30,代码来源:donation_log.php

示例10: display_str

    ?>
" size="30" />
			</td>
			<td>
				<input type="text" name="comment" value="<?php 
    echo display_str($Comment);
    ?>
" size="60" />
			</td>
			<td>
				<?php 
    echo format_username($UserID, $Username);
    ?>
<br />
				<?php 
    echo time_diff($Time, 1);
    ?>
</td>
			<td>
				<input type="submit" name="submit" value="Edit" />
				<input type="submit" name="submit" value="Delete" />
			</td>
		</form>
	</tr>
<?php 
}
?>
<tr>
	<td colspan="4" class="colhead">Add To Email Blacklist</td>
</tr>
<tr class="rowa">
开发者ID:morilo,项目名称:ptpimg,代码行数:31,代码来源:eb.php

示例11: while

        $Requests = $DB->has_results();
        if ($Requests > 0) {
            while (list($RequestID, $FillerID, $FillerName, $FilledTime) = $DB->next_record()) {
                ?>
						<div style="text-align: right;">
							<strong class="important_text"><a href="user.php?id=<?php 
                echo $FillerID;
                ?>
"><?php 
                echo $FillerName;
                ?>
</a> used this torrent to fill <a href="requests.php?action=viewrequest&amp;id=<?php 
                echo $RequestID;
                ?>
">this request</a> <?php 
                echo time_diff($FilledTime);
                ?>
</strong>
						</div>
<?php 
            }
        }
    }
    ?>
					</td>
				</tr>
<?php 
    // END REPORTED STUFF :|: BEGIN MOD STUFF
    ?>
				<tr>
					<td class="label">
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:delete.php

示例12: pretty_size

    ?>
torrent/<?php 
    echo $torrent->fid;
    ?>
"><?php 
    echo $torrent->title;
    ?>
</a><br />

				<span class="info">
					<?php 
    echo pretty_size($torrent->size);
    ?>
;
					added <?php 
    echo time_diff($torrent->ctime);
    ?>
					by
					<?php 
    $this->renderElement('user_byline', array('user' => $torrent->user));
    ?>
					in category <a href="<?php 
    echo WWW_BASE_PATH;
    ?>
browse/<?php 
    echo $torrent->category->slug;
    ?>
"><?php 
    echo $torrent->category->name;
    ?>
</a>
开发者ID:bencochran,项目名称:yeti,代码行数:31,代码来源:index.php

示例13: gixlg_execsqlrequest


//.........这里部分代码省略.........
</td></tr>
</tfoot>
<tbody>
<?php 
            while ($d = mysqli_fetch_assoc($res)) {
                $as_info_dns = dns_get_record("AS" . $d['asn'] . ".asn.cymru.com", DNS_TXT);
                list($as_info['as'], $as_info['country'], $as_info['rir'], $as_info['date'], $as_info['desc']) = explode("|", $as_info_dns[0]['txt']);
                $asinfo = explode(" ", $as_info['desc']);
                if ($d['type'] == '4') {
                    $res_node = mysqli_query($mid, "SELECT * FROM `nodes` WHERE `ip4`='" . $d['neighbor'] . "'");
                } else {
                    $res_node = mysqli_query($mid, "SELECT * FROM `nodes` WHERE `ip6`='" . $d['neighbor'] . "'");
                }
                $d_node = mysqli_fetch_assoc($res_node);
                echo "<tr>";
                echo "<td>" . $d_node['vendor'] . " " . $d_node['model'] . "</td>";
                echo "<td>" . $d_node['location'] . "</td>";
                echo "<td>" . $as_info['country'] . "</td>";
                echo "<td>" . strtoupper($as_info['rir']) . "</td>";
                echo "<td>" . $asinfo[1] . "</td>";
                echo "<td>" . $d['asn'] . "</td>";
                echo "<td>" . $d['neighbor'] . "</td>";
                echo "<td>" . $d['type'] . "</td>";
                if ($d['status'] == 1) {
                    echo "<td>up</td>";
                } else {
                    echo "<td>down</td>";
                }
                echo "<td>" . $d['prefixes'] . "</td>";
                echo "<td>" . $d['updown'] . "</td>";
                if ($d['time'] == '0000-00-00 00:00:00') {
                    echo "<td>never</td>";
                } else {
                    echo "<td>" . time_diff($d['time']) . "</td>";
                }
                if ($d['lastup'] == '0000-00-00 00:00:00') {
                    echo "<td>never</td>";
                } else {
                    if ($d['status'] == 0) {
                        echo "<td>" . $d['lastup'] . "</td>";
                    } else {
                        echo "<td>" . time_diff($d['lastup']) . "</td>";
                    }
                }
                if ($d['lastdown'] == '0000-00-00 00:00:00') {
                    echo "<td>never</td>";
                } else {
                    if ($d['status'] == 1) {
                        echo "<td>" . $d['lastdown'] . "</td>";
                    } else {
                        echo "<td>" . time_diff($d['lastdown']) . "</td>";
                    }
                }
                echo "</tr>";
            }
            echo "</tbody>";
            echo "</table>";
            break;
        case 20:
            if ($ipnet == 1) {
                $res = mysqli_query($mid, "SELECT * FROM `prefixes` WHERE (`prefix`='{$argument}') ORDER BY LENGTH(aspath),`neighbor`,(neighbor+0),`neighbor`");
            } else {
                $int_ip = inet_ptoi($argument);
                if ($gixlg['ignore_default_routes']) {
                    $res = mysqli_query($mid, "SELECT * FROM `prefixes` WHERE (MBRCONTAINS(ip_poly, POINTFROMWKB(POINT({$int_ip}, 0))) && (`prefix`!='::/0') and (`prefix`!='0.0.0.0/0')) ORDER BY LENGTH(aspath),`neighbor`,(neighbor+0),`neighbor`");
                } else {
开发者ID:atwardowski,项目名称:gixlg,代码行数:67,代码来源:gixlg-core.php

示例14: while

"><?php 
echo $Username;
?>
</a></h2>
<table width="100%">
	<tr class="colhead">
		<td>Changed</td>
		<td>IP [<a href="/userhistory.php?action=ips&userid=<?php 
echo $UserID;
?>
">H</a>]</td>
	</tr>
<? while(list($ChangeTime, $ChangerIP) = $DB->next_record()){ ?>
	<tr class="rowa">
		<td><?php 
echo time_diff($ChangeTime);
?>
</td>
		<td><?php 
echo display_str($ChangerIP);
?>
 [<a href="/user.php?action=search&ip_history=on&ip=<?php 
echo display_str($ChangerIP);
?>
" title="Search">S</a>]<br /><?php 
echo get_host($ChangerIP);
?>
</td>
	</tr>
<? } ?>
</table>
开发者ID:4play,项目名称:gazelle2,代码行数:31,代码来源:password_history.php

示例15: time_diff

            $User = '<strong>' . $User . '</strong>';
        }
    }
    if ($i % 2 == 0 && $i > 0) {
        ?>
	</tr>
	<tr>
<?php 
    }
    ?>
		<td><?php 
    echo $User;
    ?>
</td>
		<td><?php 
    echo time_diff($Timestamp);
    ?>
</td>
<?php 
    $i++;
}
?>
	</tr>
</table>
<?php 
if ($NumResults > 100) {
    ?>
<div class="linkbox"><?php 
    echo js_pages('show_downloads', $_GET['torrentid'], $NumResults, $Page);
    ?>
</div>
开发者ID:Kufirc,项目名称:Gazelle,代码行数:31,代码来源:downloadlist.php


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