PHP strtotime returns wrong result when evaluating

I have the following which should last days and hours before the kicksoff match / starts

    $time=$row['event_time'];
    $gameDate = $row['event_date'];

if($gameDate !== $lastDate){
        $calcDate= strtotime('Ymd',$gameDate,$time); //suspect problem is here
        var_dump($calcDate);
    $remaining = $calcDate - time();
        $days_remaining = floor($remaining / 86400);
        $hours_remaining = floor(($remaining % 86400) / 3600);
    echo'<tr style="background-color:red;">';
        $lastDate = $gameDate;
                echo '<td style="background-color:#2980b9"><strong style="color:white">'.$gameDate.'</strong></td>';

      

However, when I do var_dump on $calcDate

, it only returnsbool false,false

I have searched and configured and tried, hoping that a more experienced php user can help me here.

Suppose the date and time is 2015-05-17 08:00

+3


source to share


1 answer


I think the line should be

$calcDate= strtotime($gameDate . " " . $time)

      



See the manual for the strtotime function for details. http://php.net/manual/en/function.strtotime.php

+4


source







All Articles