duanheye7423 2015-05-29 19:27
浏览 27
已采纳

从另一个DateInterval中减去DateInterval

$date1 = new DateInterval('PT100S'); //100 seconds
$date2 = new DateInterval('PT20S');  //20 seconds

How to make $date1 - $date2? I've searched on google for hours.

  • 写回答

2条回答 默认 最新

  • douwen7603 2015-05-29 19:51
    关注

    Use format to get the number of seconds, then do the subtraction.

    echo $date1->format('%s') - $date2->format('%s');
    

    Is this what you wanted?

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?