I have 3 text vars,
$date1 = '2006-10-15';
$date2 = '2007-07-01';
$date3 = '2010-10-15';
Each of them contains a date-like value. How can I know for eg, if $date2 is between $date1 and $date3 ?
I have 3 text vars,
$date1 = '2006-10-15';
$date2 = '2007-07-01';
$date3 = '2010-10-15';
Each of them contains a date-like value. How can I know for eg, if $date2 is between $date1 and $date3 ?
There’s a few ways of doing this, but I’d convert them to timestamps and then compare:
$timestamp = strtotime($date2);
if ($timestamp >= strtotime($date1) && $timestamp =< strtotime($date3))
{
// $date2 is in between $date1 & $date3
}