PHP check if timestamp is greater than 24 hours from now

datetime, php, strtotime

Solution

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

should be

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

See difference in this CodePad

Problem

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 `yes`. To me this is saying the `$date` is greater than now plus 86400 seconds when in fact its only 10800 seconds away. Should this not be returning `no`?

Original source