Page 1 of 1

Time is less than

Posted: Mon Nov 26, 2007 6:19 pm
by aceconcepts
Hi,

I want to determine whether an order has been placed before 14:00:00.

My time format in the database is formatted as "H:i:s".

How can I do this:

Code: Select all

if($orderTime<=14:00:00){
   //Do something
}
Thanks.

Posted: Mon Nov 26, 2007 6:57 pm
by aaronhall
It's best to convert your existing format to either a mysql datetime (if you're storing in mysql) or unix timestamps (see strtotime()) for this reason. If not, use explode() and convert each element to its respective value in seconds, add the three values together, and make the comparison.