How to get time difference in minutes in PHP

后端 未结 17 2302
独厮守ぢ
独厮守ぢ 2020-11-21 07:22

How to calculate minute difference between two date-times in PHP?

17条回答
  •  忘掉有多难
    2020-11-21 08:01

    Subtract the times and divide by 60.

    Here is an example which calculate elapsed time from 2019/02/01 10:23:45 in minutes:

    $diff_time=(strtotime(date("Y/m/d H:i:s"))-strtotime("2019/02/01 10:23:45"))/60;
    

提交回复
热议问题