My code function is get all value where season from/to in ranges selected years.
I have 2 dropdown for user to select season from/to year . But i have a bug that i can't get value if the tour have both season from/to smaller/larger than selected year . Example:
selected season from/to : 2015 -2016
from to
2011-05-06 2014-11-12 (not get - work)
2012-04-01 2015-12-31 (get - work)
2015-01-01 2016-08-10 (get - work)
2016-08-11 2018-12-28 (get - work)
2017-01-01 2018-01-01 (not get - work)
2014-01-11 2017-01-01 (I want get this too, because my selected year is 2015-2016)
My code:
$first_day = mktime(0, 0, 0, 1, 1, $params['seasonfrom']) ; //2015-01-01
$first_day = "'".date('Y-m-d',$first_day)."'";
$last_day = mktime(0, 0, 0, 12, 31, $params['seasonto']) ; //2016-12-31
$last_day = "'".date('Y-m-d',$last_day)."'";
$str1.="(ts.SsnFrom >= {$first_day} AND ts.SsnFrom <={$last_day}
OR ts.SsnTo >= {$first_day} AND ts.SsnTo <={$last_day})";
CAn anyone give me a solution .Thanks!!