So it’s possible to compare times with <, >, etc, but when used with strtotime, you get the unix timestamp so you can’t compare the times independent of the dates.
What I’d like to do is be able to express something like:
$reference_time = "2010-01-01 18:00:00";
print strtotime("19:00:00") > strtotime($reference_time);
print strtotime("16:00:00") > strtotime($reference_time);
But I’d like the second expression to return false (since, ignoring the date, the time is less). What’s the simplest way to do this? (Preferably without splitting the string)
strtotimehas a second parameter, too. Try:Demo: http://codepad.org/uG4bsxTH