i have a combobox that show the month from jan till dec where the user can choose which month they want to view the data..this is for the 1st data..
for i := iYear - 2 to iYear + 1 do begin
for j := 1 to 12 do begin
dTem := EncodeDate(i, j, 1);
sTem := FormatDateTime('mmm yyyy', dTem);
cboMonth.Items.Add(sTem);
end;
end;
dFromDate := EncodeDate(iYr, iMon, 1);
dToDate := EncodeDate(iYr, iMon, DaysInMonth(iYr, iMon));
My problem is i also want to show the data for the year..when the user choose the month from the combobox then automatically my data will display t开发者_高级运维he data from 6 month before untill the month that they choose from the combobox..
Check out IncMonth.
Try this:
dToDate := incmonth(dFromDate, -6);// -6 = Less 6 months
精彩评论