I am using PHP\'s Date functions in my project and want to check weather a given date-time lies between the given range of date-time.i.e for example if the current date-time
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
}