php计算两个时间相差的天数、小时数、分钟数、秒数

来源:互联网 发布:仿网易彩票源码 编辑:程序博客网 时间:2024/03/28 16:32
$startdate="2011-3-15 11:50:00";$enddate="2012-12-12 12:12:12";$date=floor((strtotime($enddate)-strtotime($startdate))/86400);echo "相差天数:".$date."天<br/><br/>";$hour=floor((strtotime($enddate)-strtotime($startdate))%86400/3600);echo "相差小时数:".$hour."小时<br/><br/>";$minute=floor((strtotime($enddate)-strtotime($startdate))%86400/60);echo "相差分钟数:".$minute."分钟<br/><br/>";$second=floor((strtotime($enddate)-strtotime($startdate))%86400%60);echo "相差秒数:".$second."秒";

转:http://www.jb51.net/article/96838.htm

阅读全文
0 0
原创粉丝点击