计算时差(以小时和分钟计)

时间:2016-12-29 05:39:26

标签: php

我需要区别这两者:

routes

输出为$time1 = strtotime('26:56:45'); $time2 = strtotime('8:21:15');

3 个答案:

答案 0 :(得分:1)

  @Pervez只需使用date()函数两个更改日期时间格式即可   下面试试吧

<?php
     $time1 = strtotime('26:56:45'); 
     $time2 = strtotime('8:21:15');
     $difference = date("H:i", ($time1 - $time2));
     echo $difference;
?>

在这里,您将获得所需的差异

答案 1 :(得分:0)

以下是答案..

示例

holder.itemView.setBackgroundDrawable(
ContextCompat.getDrawable(itemView.getContext(), R.drawable.bubble))

答案 2 :(得分:0)

$datetime1 = new DateTime("10:50:30");

$datetime2 = new DateTime("now");

$interval = $datetime1->diff($datetime2);

echo $interval->h,":",$interval->i,":",$interval->s;