I have three dates A, B and C.
A = 2013-08-10 10:00
B = 2013-08-10 12:00
C = 2013-08-10 10:22
What I am trying to do is check if C is inside A and B, if it is return true. Anyone have any idea of how to do this?
I tried this with no luck
if ($time >= $date_start && $time <= $date_end)
{
echo "is between\n";
} else {
echo 'no';
}
Use the strtotime function.
You can convert them to UNIX timestamp to compare.
Use the
DateTime
class:use the following code to compare date value in php