Calculate difference between 2 times in hours in PHP

后端 未结 7 706
無奈伤痛
無奈伤痛 2020-12-10 20:11

I have two times - For eg- the current time - 08:24 and date is 02/01/2013 in dd/mm/yyyy format and I have another time at 13:46 and date is 31/12/2012 . So, how can I cal

7条回答
  •  不思量自难忘°
    2020-12-10 20:24

    If you have the dates as timestamps (use strtotime if needed), then just subtract them, optionally take the absolute value, then divide to 3600 (number of seconds in an hour). Easy ^_^

提交回复
热议问题