hello,

i suggest you an other way to prevent multiple tests.
i convert the couple year-month to a integer value, plus or minus the number of months you want and then revert to a couple year-month.
 Code:
dim $num, $olddate

"- current date : " @date ?

$num = SerializeMonth(@date)

"- search 2 months before" ?
$olddate = unserializemonth($num-2)
$year = left($olddate,4)
$month = substr($olddate,6,2)

"2 months before : " $year "/" $month ?
?

"- search 6 months after" ?
$olddate = unserializemonth($num+6)
$year = left($olddate,4)
$month = substr($olddate,6,2)

"6 months after  : " $year "/" $month ?
?
quit


function SerializeMonth( $date )
	; $date in format yyyy/mm

	dim $year, $month
	$year = left($date,4)
	$month = substr($date,6,2)

	$SerializeMonth = val($year)*12 + $month - 1
endfunction

function UnSerializeMonth( $num )
	dim $year, $month
	$month = $num mod 12 + 1
	$year  = $num / 12

	$UnSerializeMonth = right("0000"+CStr($year),4)+"/"+Right("00"+CStr($month),2)
endfunction
Example of result
 Quote:
- current date : 2017/01/07
- search 2 months before
2 months before : 2016/11

- search 6 months after
6 months after : 2017/07
_________________________
Christophe