bra*_*fck 10
使用strtotime()将时间解析为时间戳,然后简单地从另一个中减去一个.
之后,您可以使用数学函数获得分钟数,天数等.
例如:
// $date1 and $date2 are given
// the difference is in seconds
$difference = strtotime($date1) - strtotime($date2);
// getting the difference in minutes
$difference_in_minutes = $difference / 60;
Run Code Online (Sandbox Code Playgroud)
参考: strtotime()
| 归档时间: |
|
| 查看次数: |
5983 次 |
| 最近记录: |