Simply use strtotime to convert the two times into unix timestamps:
A sample function could look like:
function dateIsBetween($from, $to, $date = 'now') {
$date = is_int($date) ? $date : strtotime($date); // convert non timestamps
$from = is_int($from) ? $from : strtotime($from); // ..
$to = is_int($to) ? $to : strtotime($to); // ..
return ($date > $from) && ($date < $to); // extra parens for clarity
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…