我要在datetimepicker1.date上加若干个月,譬如4个月,2个月,不固定,具体的保存在变量count里,关键代码如下
decodedate(datetimepicker1.Date,year,month,day);
count:=table2.fieldByName('jieshuqi').AsInteger;
month:=month+count;
if month>12 then//格式化月份1-12之间
begin
year:=year+1;
month:=month-12;
end;
datetimepicker2.date:=encodedate(year,month,day);
为什么month:=month+count;这条语句有错,不管count是integer型还是dword型,而
month:=month+2就好用呢?
另外有更好的方法在给定的日期上加若干个月的吗?
decodedate(datetimepicker1.Date,year,month,day);
count:=table2.fieldByName('jieshuqi').AsInteger;
month:=month+count;
if month>12 then//格式化月份1-12之间
begin
year:=year+1;
month:=month-12;
end;
datetimepicker2.date:=encodedate(year,month,day);
为什么month:=month+count;这条语句有错,不管count是integer型还是dword型,而
month:=month+2就好用呢?
另外有更好的方法在给定的日期上加若干个月的吗?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货