I want to make sure that the current $date and $time are before the $closetime and $closedate. If it is echo open if not echo close... this is what I have but it does not work.. anyone know why???
$time = 4:45:06 pm; $date = 2005-10-22; $closetime =4:45:00 pm; $closedate = 2005-10-22; if ($closetime && $closedate > $time && $date) { echo "Closed"; } else { Echo "Open"; }
simple, php interprets ur condition using string comparison rules.
so, u first convert btoth dates to timestamps andcheck as
if ($closed_stamp > $timestamp) ...............
Actually it falls over with a parse error because "$time = 4:45:06 pm;" is invalid PHP syntax 🙂. (Even if that worked, $date would equal 1973 because that's 2005-10-22.)
OKay toxic_brain how do I select a date and time with a web form and then convert that to a unix timestamp
[man]strtotime[/man].