Find the difference between two dates in hours?

前端 未结 3 592
长情又很酷
长情又很酷 2021-01-28 13:55

For example I can calculate the difference of these two dates by looking at them but i have no clue when it comes to calculating this in a program.

Dates: A is 201

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-28 14:39

    an easy (not to talk about timezones) approach is to convert both dates (datetimes) to secounds since 1/1/1970. the build the difference and (tada) devide by 3600

    mktime() should do the work, if I remeber correctly

    HTH

提交回复
热议问题