例子:计算两个时间相差的天数
类别: PHP教程
<?
$time1 = mktime(10,20,30,2,5,2000); //2000-2-5 10:20:30
$time2 = mktime(18,30,20,5,2,2000); //2000-5-2 18:30:20
$diff = (int)(($time2-$time1)/(24*3600));
echo "$time2 和 $time1 的时间差为:" . $diff . "天<br>";
?>
$time1 = mktime(10,20,30,2,5,2000); //2000-2-5 10:20:30
$time2 = mktime(18,30,20,5,2,2000); //2000-5-2 18:30:20
$diff = (int)(($time2-$time1)/(24*3600));
echo "$time2 和 $time1 的时间差为:" . $diff . "天<br>";
?>
- 上一篇: 实例学习PHP之投票程序篇
- 下一篇: 例子:用getenv函数获取各种CGI环境变量
-= 资 源 教 程 =-
文 章 搜 索