checking date range

I want to start a function, if it only lies between a data range. the date range is from: 1-10-1-2016 till 31-03-2017.

I have this:

startdate:= 01102016D;
enddate := 31032017D;
SETRANGE(“startdate”, " enddate");

IF (ToSalesLine.“No.” <> Rec.“No.”) AND (STRPOS(ToSalesLine.“Description 2”, ‘orado’) > 0) THEN
ToSalesLine.VALIDATE(“Line Discount %”, 100);
IF (ToSalesLine.“No.” <> Rec.“No.”) AND (STRPOS(ToSalesLine.“Description 2”, ‘efit’) > 0) THEN
ToSalesLine.VALIDATE(“Line Discount %”, 100);

So if this lies between 1-10-2016 and 31-03-2017 then execute the lines.

Thank you

Hi,
For Reference Look into codeunit 11 Function DateNotAllowed. This checks the dates for every posting based on user setup and general ledger setup.
You can create a function like this.

I have it now like this:

StartDateNefit:= 011016D;
EndDateNefit := 310317D;

IF StartDateNefit = TODAY THEN BEGIN
IF (ToSalesLine.“No.” <> Rec.“No.”) AND (STRPOS(ToSalesLine.“Description 2”, ‘efit’) > 0) THEN
ToSalesLine.VALIDATE(“Line Discount %”, 100);
END;

But I still dont have the between(setrange). I only have begin date

Hi Zodiac,
How about ?

IF (Today >= StartDate) AND (Today <= EndDate) THEN