Php 如何获取弹药中当前时间与给定时间的时差

Php 如何获取弹药中当前时间与给定时间的时差,php,Php,我想得到给定时间与当前时间之间的时差,从UNIX格式计算 我的代码没有给我正确的答案 我的PHP代码: 尝试: $my_time = 1407410382; $time_diff = strtotime(strftime("%F") . ' ' .$my_time) - time(); $then = 1407410382; //Get the current timestamp. $now = time(); //Calculate the difference. $difference

我想得到给定时间与当前时间之间的时差,从UNIX格式计算

我的代码没有给我正确的答案

我的PHP代码:

尝试:

$my_time = 1407410382;
$time_diff = strtotime(strftime("%F") . ' ' .$my_time) - time();
$then = 1407410382;

//Get the current timestamp.
$now = time();

//Calculate the difference.
$difference = $now - $then;

//Convert seconds into minutes.
$minutes = floor($difference / 60);

echo $minutes;