Is you're timezone properly set to california time? That would be the first step, either set that at california time for local, or set it to GMT to use as you're base time.
Next, the problem is likely due to this:
date(H) < 09
. First and foremost, technically the date wants a string, not a constant. Fortunately, this will just trigger notices in PHP; it will interpret non-defined constants as strings, so it still sees it as date('H'). Best to change them to strings though. The problem with the code is the 09. That is an incorrect octal number, which will be interpreted as 0 in an integer comparison. What you want is '9' or 9 (the string is more accurate since date() returns a string).
And a couple of extra notes. The first is that you can simplify this with strtotime.
when time is 8pm will return 9pm. Next, this is bad:
. Never globalize any variable in a function or method where you can redefine the signature. The only situations where you should need to globalize are where you require particular callback signatures, functions like usort, set_error_handler (this you'll find is often globalizing a file handle), etc. Instead, alter you're signature to take a parameter for it:
and call it with the argument. Doing this eliminates the need to understand the code with extensions (and in particular, comparing to a language like C where its compiled, you cannot view what the name of the variable is, but it must be the same in order to be globalized).
BTW, I figure that this octal is the primary problem with this code:
As you can see, the 09 is treated as an integer(0), so you'll want that to actually be a string (since date('H') returns zero padded if less than 12).
>php -r "print strcmp(date('H', strtotime('09:18')), 09);"
>php -r "print strcmp(date('H', strtotime('09:18')), '09');"