Naterade Naterade - 11 months ago 45
PHP Question

PHP check if timestamp is greater than 24 hours from now

I have software that needs to determine if the cutoff datetime is greater than 24 hours from now. Here is the code I have to test that.

$date = strtotime("2013-07-13") + strtotime("05:30:00");

if($date > time() + 86400) {
echo 'yes';
} else {
echo 'no';

My current date and time is 2013-07-13 2am. As you can see its only 3 hours away.
At my math thats 10800 seconds away. The function I have is returning
. To me this is saying the
is greater than now plus 86400 seconds when in fact its only 10800 seconds away. Should this not be returning

Answer Source
$date = strtotime("2013-07-13") + strtotime("05:30:00");

should be

$date = strtotime("2013-07-13 05:30:00");

See difference in this CodePad