Hi All,
In my Accounting program I need to get the records which are between the selected dates. (i.e. financial year, 1st July last year to 31st June this year)
I assume I do a SQL Date>StartDate and Date<EndDate.
I need to be able to create these Start and End dates.
Any Ideas anyone.
in Delphi I use this routine
DecodeDate(Now,Y,M,Day);
Case InfoYearFilter of
0: begin
if M<7 then begin
dFrom:= EncodeDate(Y-1,7,1);
dTo := EncodeDate(Y,6,30);
end else begin
dFrom:= EncodeDate(Y,7,1);
dTo := EncodeDate(Y+1,6,30);
end;
if (DataSet.FieldByName('InvDate').asDateTime >= dFrom) and (DataSet.FieldByName('InvDate').asDateTime <= dTo) then Maybe:=True;
end;
Tom
In my Accounting program I need to get the records which are between the selected dates. (i.e. financial year, 1st July last year to 31st June this year)
I assume I do a SQL Date>StartDate and Date<EndDate.
I need to be able to create these Start and End dates.
Any Ideas anyone.
in Delphi I use this routine
DecodeDate(Now,Y,M,Day);
Case InfoYearFilter of
0: begin
if M<7 then begin
dFrom:= EncodeDate(Y-1,7,1);
dTo := EncodeDate(Y,6,30);
end else begin
dFrom:= EncodeDate(Y,7,1);
dTo := EncodeDate(Y+1,6,30);
end;
if (DataSet.FieldByName('InvDate').asDateTime >= dFrom) and (DataSet.FieldByName('InvDate').asDateTime <= dTo) then Maybe:=True;
end;
Tom
Last edited: