Create Day, Hour, Minute and Second countdown in PHP

前端 未结 3 1683
無奈伤痛
無奈伤痛 2021-01-26 03:47

So far I\'ve got this script that counts down the days and hours, but how can I make it also do minutes and seconds?

$remaining = strtotime($ActiveListing[\'Lis         


        
3条回答
  •  粉色の甜心
    2021-01-26 04:46

    $edate = '2027-07-06 07:01:53';
    $datestr = $edate;//Your date
    $date=strtotime($datestr);//Converted to a PHP date (a second count)
    //Calculate difference
    $diff=$date-time();//time returns current time in seconds
    $days=floor($diff/(60*60*24));//seconds/minute*minutes/hour*hours/day)
    $hours=round(($diff-$days*60*60*24)/(60*60)); 
    

提交回复
热议问题