本文整理汇总了PHP中sec2hms函数的典型用法代码示例。如果您正苦于以下问题:PHP sec2hms函数的具体用法?PHP sec2hms怎么用?PHP sec2hms使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sec2hms函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format_time
function format_time($seconds)
{
// Get our seconds to hours:minutes:seconds
$time = sec2hms($seconds, false);
// Explode the time
$time = explode(':', $time);
// Hour corrections
$set = '';
if ($time[0] > 0) {
// Set days if viable
if ($time[0] > 23) {
$days = floor($time[0] / 24);
$time[0] = $time[0] - $days * 24;
$set .= $days > 1 ? $days . ' Days' : $days . ' Day';
if ($time[0] > 0) {
$set .= ',';
}
}
$set .= $time[0] > 1 ? $time[0] . ' Hours' : $time[0] . ' Hour';
}
if ($time[1] > 0) {
$set .= $time[0] > 0 ? ', ' : '';
$set .= $time[1] > 1 ? $time[1] . ' Minutes' : $time[1] . ' Minute';
}
return $set;
}
示例2: getTimediff
function getTimediff($string)
{
$a = array();
$a = explode("#", $string);
$count = 0;
$st1 = array();
$en1 = array();
$flag = 0;
$flag1 = 0;
$time = array();
foreach ($a as $key => $str) {
$s_str = explode(',', $str);
if (isset($str) && $str != "") {
if (strpos($s_str[7], "[2=1]") && strpos($s_str[7], "[3=1]") && $s_str[3] == '0' && $flag == '0') {
$st1 = $s_str[8] . ',' . $s_str[9];
$flag = $key;
}
if ($flag != "") {
if ($s_str[3] != '0' && $flag1 == '0') {
$en1 = $s_str[8] . ',' . $s_str[9];
$flag1 = $key;
}
}
if ($flag1 != "" && $flag != "") {
$diff = strtotime($en1) - strtotime($st1);
if ($diff > '0' && strlen($diff) > 1) {
$time[$st1][$en1][] = sec2hms($diff);
$flag1 = 0;
$flag = 0;
}
}
}
}
return $time;
}
示例3: timeformat
function timeformat($input)
{ //samples to secs to hms
global $tScale;
$secs = $input * $tScale;
$formatted = formatHms(sec2hms($secs));
return $formatted;
}
示例4: getTimediff
function getTimediff($string)
{
$a = array();
$a = explode("#", $string);
$count = 0;
$st1 = array();
$en1 = array();
$flag = 0;
$flag1 = 0;
$st_flag = 0;
$en_flag = 0;
foreach ($a as $key => $str) {
//echo strpos($str,"[2=1]");
if (strpos($str, "[3=1]") && $st_flag == '0') {
$st = substr($str, strpos($str, "[3=1]"), strlen($str));
$st1[$key] = substr($st, strpos($st, ",") + 1, 19);
$flag = $key;
$st_flag = 1;
}
if ($flag != "") {
if (strpos($str, "[3=0]") && $en_flag == '0') {
$en = substr($str, strpos($str, "[3=0]"), strlen($str));
$en1[$key] = substr($en, strpos($en, ",") + 1, 19);
$flag1 = $key;
$en_flag = 1;
}
}
if ($flag1 > $flag) {
if ($st_flag == 1 && $en_flag == 1) {
$diff = strtotime($en1[$flag1]) - strtotime($st1[$flag]);
if ($diff > '0') {
$time[$st1[$flag]][$en1[$flag1]][] = sec2hms($diff);
}
$flag1 = 0;
$flag = 0;
$st_flag = 0;
$en_flag = 0;
}
}
}
return $time;
}
示例5: ObjectId
/**
> db.SessionLog.find();
{ "_id" : ObjectId("4ed4b255c1b4ba6c09000005"), "session_id" : "19aebff52b0cada12ee5f1efbd5583d8", "time_end" : "2011-12-02 08:48:35", "time_start" : "2011-11-29 17:22:13", "user_id" : "4df6e7192cbfd4e6c000fd9b", "username" : "rully" }
{ "_id" : ObjectId("4ed83050c1b4bac009000000"), "session_id" : "1902b9a2a85bf983f4afa98e14bf4c94", "time_end" : "2011-12-02 08:56:32", "time_start" : "2011-12-02 08:56:32", "user_id" : "4df6e7192cbfd4e6c000fd9b", "username" : "rully" }
*/
function report_admin_onlinetime($user_id = NULL)
{
// $time_int = strtotime("2011-12-02 08:48:35");
//
// $time_int_reformatted = date("Y-m-d H:i:s", $time_int);
//
// print("String: " . "2011-12-02 08:48:35" . "<br />");
// print("Timestamp: " . $time_int . "<br />");
// print("Timestamp Reformatted: " . $time_int_reformatted . "<br />");
$lilo_mongo = new LiloMongo();
$lilo_mongo->selectDB('Users');
$lilo_mongo->selectCollection('SessionLog');
$user_id = isset($user_id) ? $user_id : func_arg(0);
$criteria = array('user_id' => $user_id);
$sess_cursor = $lilo_mongo->find($criteria);
$total_time = 0;
while ($curr = $sess_cursor->getNext()) {
$time_start = strtotime($curr['time_start']);
$time_end = strtotime($curr['time_end']);
$total_time += $time_end - $time_start;
}
// return $total_time;
return sec2hms($total_time, true);
}
示例6: LibraryAssignView
/**
* Show the library
* @return
*/
function LibraryAssignView()
{
$db =& $this->db;
$user =& $this->user;
$response = new ResponseManager();
//Input vars
$mediatype = Kit::GetParam('filter_type', _POST, _STRING);
$name = Kit::GetParam('filter_name', _POST, _STRING);
// Get a list of media
$mediaList = $user->MediaList(NULL, array('type' => $mediatype, 'name' => $name));
$rows = array();
// Add some extra information
foreach ($mediaList as $row) {
$row['duration_text'] = sec2hms($row['duration']);
$row['list_id'] = 'MediaID_' . $row['mediaid'];
$rows[] = $row;
}
Theme::Set('table_rows', $rows);
// Render the Theme
$response->SetGridResponse(Theme::RenderReturn('library_form_assign_list'));
$response->callBack = 'LibraryAssignCallback';
$response->pageSize = 5;
$response->Respond();
}
示例7: Duration
?>
/ <?php
echo $result['total_question'];
?>
</td></tr>
<tr><td bgcolor="#eeeeee" >Obtained Percentage </td><td bgcolor="#eeeeee"><?php
echo $result['obtained_percentage'];
?>
% </td></tr>
<tr><td bgcolor="#ffffff">Time Taken / Time Duration (H:M:S)</td><td bgcolor="#ffffff">
<?php
$time_taken = explode(",", $result['time_taken']);
echo sec2hms(array_sum($time_taken));
?>
/ <?php
echo sec2hms($result['test_time'] * 60);
?>
</td></tr>
<tr><td bgcolor="#eeeeee">Status</td><td bgcolor="#eeeeee"><?php
if ($result['status'] == "1") {
echo "Pass";
} else {
echo "Fail";
}
?>
</td></tr>
</table>
</code>
示例8: get_youtube_id
} else {
$rowcontent['vid_type'] = 5;
//hotlink from other site
}
} else {
$rowcontent['vid_path'] = '';
}
// Auto-Thumb from Youtube - if empty Image
if ($rowcontent['vid_type'] == 2 and empty($rowcontent['homeimgfile'])) {
$rowcontent['homeimgfile'] = 'http://img.youtube.com/vi/' . get_youtube_id($rowcontent['vid_path']) . '/0.jpg';
$rowcontent['homeimgthumb'] = 3;
}
// Auto-duration from Youtube - if empty
if ($rowcontent['vid_type'] == 2 and empty($rowcontent['vid_duration'])) {
$_vid_duration = youtubeVideoDuration($rowcontent['vid_path']);
$rowcontent['vid_duration'] = sec2hms($_vid_duration);
}
if ($rowcontent['id'] == 0) {
if (!defined('NV_IS_SPADMIN') and intval($rowcontent['publtime']) < NV_CURRENTTIME) {
$rowcontent['publtime'] = NV_CURRENTTIME;
}
if ($rowcontent['status'] == 1 and $rowcontent['publtime'] > NV_CURRENTTIME) {
$rowcontent['status'] = 2;
}
$sql = 'INSERT INTO ' . NV_PREFIXLANG . '_' . $module_data . '_rows
(catid, listcatid, admin_id, admin_name, author, artist, sourceid, addtime, edittime, status, publtime, exptime, archive, title, alias, hometext, vid_path, vid_duration, vid_type, homeimgfile, homeimgalt, homeimgthumb, inhome, allowed_comm, allowed_rating, hitstotal, hitscm, total_rating, click_rating) VALUES
(' . intval($rowcontent['catid']) . ',
:listcatid,
' . intval($rowcontent['admin_id']) . ',
:admin_name,
:author,
示例9: vote
public function vote($action = NULL, $id = 0)
{
// Make sure the user is logged in HERE!
if ($this->user['logged_in'] == FALSE) {
redirect('account/login');
}
// Load the vote model, and time helper
$this->load->model('Vote_Model', 'model');
$this->load->helper('Time');
// See if we need redirecting!
if ($action == 'out' && $id != 0) {
$site = $this->model->get_vote_site($id);
redirect($site['votelink']);
die;
}
// Load this users vote data
$vote_data = $this->model->get_data($this->user['id']);
// Get all the vote sites information
$list = $this->model->get_vote_sites();
$sites = array();
// Correct the array keys
foreach ($list as $site) {
$sites[$site['id']] = $site;
}
// Process the time left for each site
$time = time();
foreach ($vote_data as $key => $value) {
// Get our remaining time left
$left = $value - $time;
if ($left > 0) {
// Time left still, Let make a fancy time string!
$sites[$key]['disabled'] = 'disabled="disabled"';
$sites[$key]['time_left'] = sec2hms($left);
} else {
// expired time, Good to vote again
$sites[$key]['disabled'] = '';
$sites[$key]['time_left'] = "N/A";
}
}
// Prepare for view
$data['sites'] = $sites;
$this->load->view('vote', $data);
}
示例10: sec2hms
echo "<div class=\"date_" . $feeditem->type_title . "_box\" style='float:right';>";
echo JHtml::date($feeditem->created_time, 'l d/m/y H:i');
echo "</div>";
echo "<div class=\"right_" . $feeditem->type_title . "_box\" style='padding-top:50px;'>";
echo "<div style=\"display:block;float:left;width:100px;\" >";
echo "<img src=\"" . $feeditem->thumb_uri . "\" class=\"profile_" . $feeditem->type_title . "_image\">";
echo "</div>";
echo "<div>";
$i = 0;
$desc = "";
echo "<div class=\"youtube_video_title\">";
echo $feeditem->title;
echo "</div>";
echo "<iframe width=\"560\" height=\"315\" src=\"" . $feeditem->source_link . "\" frameborder=\"0\" allowfullscreen></iframe>";
echo "<div class=\"youtube_duration\">";
echo sec2hms($feeditem->duration);
echo "</div>";
echo "<div>";
echo "<div class=\"redsocial_description " . $feeditem->type_title . "\">";
preg_match_all('/(http|https)\\:\\/\\/[a-zA-Z0-9\\-\\.]+\\.[a-zA-Z]{2,3}[^<]*/', str_replace("\n", "<br />", $feeditem->message), $out, PREG_PATTERN_ORDER);
foreach ($out[0] as $link) {
$feeditem->message = str_replace($link, "<a href=\"" . $link . "\">" . $link . "</a>", $feeditem->message);
}
echo str_replace("\n", "<br />", $feeditem->message);
echo "</div>";
echo "</div>";
echo "</div>";
echo "</div>";
echo "<div style=\"clear:both;\"></div>";
echo "</div><br/><hr/><br/>";
}
示例11: post_params
function post_params($phpvars)
{
global $config, $editpostparamid, $FormMethod;
$postprocessconfig = LoadPostProcessConfig($config);
if (!isset($postprocessconfig)) {
return;
}
echo '<form action="status.php" method=' . $FormMethod . '">';
echo '<input type="hidden" name="save" value="1">';
echo '<input type="hidden" name="editpostparam" value="1">';
echo '<input type="hidden" name="id" value="' . $editpostparamid . '">';
$hasparams = false;
$cur_queued = null;
if (isset($phpvars['activegroup']) && $phpvars['activegroup']['LastID'] == $editpostparamid) {
$cur_queued = $phpvars['activegroup'];
} else {
foreach ($phpvars['queuedgroups'] as $cur) {
if ($cur['LastID'] == $editpostparamid) {
$cur_queued = $cur;
break;
}
}
}
if ($cur_queued != null) {
echo '<div class = "block"><center>Postprocessing parameters</center><br>';
echo '<table width="100%">';
echo '<tr><td></td><td>name</td><td width="20">category</td><td width="60" align="right">total</td><td width="60" align="right">left</td><td width="100" align="right">estimated time</td></tr>';
$grouppaused = $cur_queued['PausedSizeLo'] != 0 && $cur_queued['RemainingSizeLo'] == $cur_queued['PausedSizeLo'];
if ($grouppaused) {
echo '<tr class="pausedgroup">';
} else {
echo '<tr class="unpausedgroup">';
}
echo '<td width="10"><a href="javascript:updatestatus(\'status.php?action=groupdelete&offset=0&id=' . $cur_queued['LastID'] . '\')"><IMG src=images/cancel.gif width=15 height=15 alt="remove nzb" title="remove nzb"></a></td>';
echo '<td>' . namereplace($cur_queued['NZBNicename']) . '</td>';
echo '<td width="20">';
add_category_combo($cur_queued['Category'], $cur_queued['LastID'], false);
echo '</td>';
echo '<td align="right">' . formatSizeMB($cur_queued['FileSizeMB']) . '</td>';
echo '<td align="right">' . formatSizeMB($cur_queued['RemainingSizeMB'] - $cur_queued['PausedSizeMB']) . '</td>';
if ($phpvars['status']['DownloadRate'] > 0) {
echo '<td align="right">' . sec2hms(($cur_queued['RemainingSizeMB'] - $cur_queued['PausedSizeMB']) / ($phpvars['status']['DownloadRate'] / 1024 / 1024)) . '</td>';
} else {
echo '<td align="right"></td>';
}
echo '</tr>';
echo '<tr><td> </td></tr>';
echo '<tr><td colspan="6">';
MergePostValues($config, $cur_queued['Parameters']);
$hasparams = count($config) > 0;
BuildOptionsContent($config, null, false);
echo '</td></tr>';
echo '</table>';
echo '</div>';
}
if (!$hasparams) {
echo '<div class="block"><table width="100%"><tr><td>';
echo '<span class="INFO">INFO</span> Current postprocessing-script does not have any postprocessing parameters.';
echo '</td></tr></table></div>';
}
echo '<div class="block"><table width="100%"><tr><td>';
if ($hasparams) {
echo '<input type="submit" value="Save changes"> ';
}
echo '<input type="button" value="Cancel" onClick="location=\'?\'">';
// TIP: uncomment for debug purposes
//echo ' <input type="button" value="Reload (for testing)" onClick="javascript:updatestatus(\'status.php?editpostparam=1&id='.$editpostparamid.'\')">';
echo '</td></tr></table></div>';
echo '</form><br>';
}
示例12: number_format
$msg .= "\t\t\t</tr>";
$msg .= "\t\t\t<tr align=\"left\" bgcolor=\"#E5ECF9\">";
$msg .= "\t\t\t\t\t<th align=\"left\">% Abandoned</th>";
$msg .= "\t\t\t\t\t<td align=\"right\">" . number_format($prcntAbnd * 100, 1, '.', '') . "%</th>";
$msg .= "\t\t\t</tr>";
$msg .= "\t\t\t<tr align=\"left\" bgcolor=\"#FFFFFF\">";
$msg .= "\t\t\t\t\t<th align=\"left\">Avg Abandoned</th>";
$msg .= "\t\t\t\t\t<td align=\"right\">" . sec2hms($avgAbnd) . "</th>";
$msg .= "\t\t\t</tr>";
$msg .= "\t\t\t<tr align=\"left\" bgcolor=\"#E5ECF9\">";
$msg .= "\t\t\t\t\t<th align=\"left\">ASA</th>";
$msg .= "\t\t\t\t\t<td align=\"right\">" . sec2hms($asa) . "</th>";
$msg .= "\t\t\t</tr>";
$msg .= "\t\t\t<tr align=\"left\" bgcolor=\"#FFFFFF\">";
$msg .= "\t\t\t\t\t<th align=\"left\">IB AHT</th>";
$msg .= "\t\t\t\t\t<td align=\"right\">" . sec2hms($ibaht) . "</th>";
$msg .= "\t\t\t</tr>";
$msg .= "\t\t\t<tr align=\"left\" bgcolor=\"#E5ECF9\">";
$msg .= "\t\t\t\t\t<th align=\"left\">Service Level</th>";
$msg .= "\t\t\t\t\t<td align=\"right\">" . number_format($serviceLvl, 1) . "%</th>";
$msg .= "\t\t\t</tr>";
$msg .= "\t\t</table>";
$msg .= "\t</td>";
$msg .= "\t</tr>";
$msg .= "\t</table>";
$msg .= "<br/><br/>..inetpub/wwwroot/plexis/" . $_SERVER['SCRIPT_NAME'];
// ********************** E-Mail Results ****************************
//$to='srahman@usimagingnetwork.com';
$to = 'mknighton@usimagingnetwork.com';
$subject = 'Monthly Call Data Summary: ' . date('F', mktime(0, 0, 0, date('m') - 1, date('d'), date('Y')));
$headers = 'MIME-Version: 1.0' . "\r\n";
示例13: foreach
<ul class="samples">
<?php
foreach ($tracks as $track => $info) {
if ($verified) {
?>
<li><a href="<?php
echo '/' . $url_prefix . '/record/' . $item['_id'] . '/download?type=play&tracknum=' . $track;
?>
" class="mp3player inline-playable"><?php
echo $track;
?>
. <?php
echo $info['title'];
?>
(<?php
echo sec2hms($info['length']);
?>
)</a><span class="right">(<?php
echo round($info['size'] / 1048576, 2);
?>
MB) <a href="<?php
echo '/' . $url_prefix . '/record/' . $item['_id'] . '/download?type=track&tracknum=' . $track;
?>
">Download Track</a></span></li>
<?php
} else {
?>
<li><?php
echo $track;
?>
. <?php
示例14: mysql_fetch_array
$array_concepts = mysql_fetch_array($chkresult_concepts);
$id_concepts = $array_concepts["id_concepts"];
}
} else {
$id_concepts = null;
}
//converto i frame in millisecondi
// $starttime_point = round($starttime*1000/$fps);
// $endtime_point = round($endtime*1000/$fps);
// $start_time_second = (int)round($starttime/$fps);
$start_time_second = $starttime / 1000;
$starttime_point = $starttime;
$endtime_point = $endtime;
log_task("selezionato secondo esportazione : " . $start_time_second . "\n");
//estrazione della thumbnail
$starttime_point_extraction = sec2hms($start_time_second);
log_task("selezionato timecode esportazione : " . $starttime_point_extraction . "\n");
$thumbnail_name = "{$filename}-{$starttime}.png";
$command = "ffmpeg -ss " . $starttime_point_extraction . " -i " . $miccDirectory . "media/video/" . $filename . " -f image2 -vframes 1 -s 320x240 " . $miccDirectory . "media/image/" . $thumbnail_name;
log_task("\neseguito: " . $command . "\n");
$result = exec($command);
// $insert_id_concept = ($id_concepts != null ?"'".$id_concepts."'": " null ");
$insert_id_concept = '10';
$now = date('Y-m-d H:i:s');
$querys = "UPDATE media SET last_modified = '" . $now . "' WHERE id_media = '" . $idfilm . "'";
$result = mysql_query($querys) or die('ERROR');
//creo la query di inserimento del concetto
$querys = "INSERT INTO annotations (id_media, title, timepoint, endpoint, id_concepts, id_users, id_annotations_types,thumbnail) VALUES ('" . $idfilm . "', '" . $conceptname . "', '" . $starttime_point . "', '" . $endtime_point . "', '" . $insert_id_concept . "', '" . $owner . "', '2','{$thumbnail_name}')";
$date = date('Y-m-d H:i:s');
$dataserverpath = $absolutePath . 'media/image/';
//echo $querys;
示例15: serverinfobox
function serverinfobox($phpvars)
{
global $webversion;
echo '<div class = "block"><center>';
echo "NZBGet " . $phpvars['version'] . "<br/>";
echo '<center>Web Interface ' . $webversion . '</center><br/>';
echo "<table width='250'>";
echo "<tr><td>uptime:</td><td align=right><nobr>" . sec2hms($phpvars['status']['UpTimeSec']) . "</nobr></td></tr>";
echo "<tr><td>download time:</td><td align=right><nobr>" . sec2hms($phpvars['status']['DownloadTimeSec']) . "</nobr></td></tr>";
echo "<tr><td><nobr>average download rate:</nobr></td><td align=right><nobr>" . round0($phpvars['status']['AverageDownloadRate'] / 1024) . " KB/s</nobr></td></tr>";
echo "<tr><td>total downloaded:</td><td align=right><nobr>" . formatSizeMB($phpvars['status']['DownloadedSizeMB']) . "</nobr></td></tr>";
echo "<tr><td>free disk space:</td><td align=right><nobr>" . formatSizeMB(freediskspace()) . "</nobr></td></tr>";
echo '</table>';
echo '</center></div><br>';
}