Home > php教程 > php手册 > 例子:计算两个时间相差的天数

例子:计算两个时间相差的天数

WBOY
Release: 2016-06-21 09:13:40
Original
1306 people have browsed it

$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 . "天
";
?>



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template