[thelist] Need some PHP Syntax help

misterhaan misterhaan at track7.org
Thu Apr 26 16:59:51 CDT 2007

Casey Crookston wrote:
> we need to determine if right now is after or before 8:00 pm on the date
> the order was placed.  
> If (strtotime("now") > strtotime(date("m/d/Y 8:00 pm",
> strtotime($OrderDate))))
i'd do this:
if(time() > strtotime(date('Y-m-d', $OrderDate) . ' 8:00 pm'))

-- the 'm' in your 'pm' is going to get translated by date() into the 
month (so you get '8:00 p04' which makes no sense).  also Y-m-d is a 
less ambiguous date format, as 04/05/2007 could be either april 5th or 
may 4th depending on where you live, but 2007-04-05 is always april 
5th.  others have mentioned time() instead of strtotime('now'), so i 
won't go over that again :)

More information about the thelist mailing list