chinavalen
新手上路

UID 70544
精华
0
积分 4
帖子 13
金钱 4 喜悦币
威望 0
人脉 0
阅读权限 10
注册 2006-3-28
状态 离线
|
[推荐阅读] 求免费的“自助建站系统”!!
这是我自己从网上招了一个类似的程序,修改了一下得到的结果,请大家看看.
<?php
class FormatSeconds
{
var $days;
var $hours;
var $minutes;
var $seconds;
function getDays()
{
return $this->days;
}
function getHours()
{
return $this->hours;
}
function getMinutes()
{
return $this->minutes;
}
function getSeconds()
{
return $this->seconds;
}
function FormatSeconds($sec)
{
$this->days = floor($sec / (24*3600));
$sec = $sec % (24*3600);
$this->hours = floor($sec / 3600);
$remainSeconds = $sec % 3600;
$this->minutes = floor($remainSeconds / 60);
$this->seconds = intval($sec - $this->hours * 3600 - $this->minutes * 60);
}
}
$fs = new FormatSeconds(1);
print $fs->getDays();
print "\n";
print $fs->getHours();
print "\n";
print $fs->getMinutes();
print "\n";
print $fs->getSeconds();
print "\n";
?>
|
|