Finding days between 2 unix timestamps in php

前端 未结 8 1180
一整个雨季
一整个雨季 2020-12-13 18:57

Hay, i have a database holding events. There are 2 fields \'start\' and \'end\', these contain timestamps. When an admin enters these dates, they only have the ability to se

8条回答
  •  生来不讨喜
    2020-12-13 19:30

    $daysInBetween = range($startTs, $endTs, 86400);
    $secondDay = date('M d Y', $daysInBetween[1]);
    /*
    $thirdDay = date('M d Y', $daysInBetween[2]);
    ...
    */
    

    Note that the range() function is inclusive.

提交回复
热议问题