我在程序中需要判断一个日期是否是一个月的最后一天,用
var:
rq:tdate;
year,month,day:word;
begin
rq:=datetimepicker1.date;
decodedate(year,month,day);
if rq=encodedate(year,month+1,1)-1 then
begin
....
程序中rq=encodedate(year,month+1,1)-1条件始终不能成立,但换成:
datetostr(rq)=datetostr(encodedate(year,month+1,1)-1)后能成立,why?
var:
rq:tdate;
year,month,day:word;
begin
rq:=datetimepicker1.date;
decodedate(year,month,day);
if rq=encodedate(year,month+1,1)-1 then
begin
....
程序中rq=encodedate(year,month+1,1)-1条件始终不能成立,但换成:
datetostr(rq)=datetostr(encodedate(year,month+1,1)-1)后能成立,why?
解决方案 »
- 调用Oracle存储过程返回数据集的问题
- listview中可不可以实现被鼠标点击过的行,字体变为粗黑.
- 如何使用ADOQUERY实现日期字段的查询?????急
- SQL2000问题?
- 如何用DELPHI实现把WORD、EXCEL和图片等存储到数据库中,并显示?
- 在先等待,高分求助!!!!
- 一个有关MDI窗口苦恼的问题。在线恭候!
- 在delphi或server2k中如何把*.xml文件转成数据库中的一个表?
- 怎样通过语句更改COMBOBOX的TEXT值?
- 谁能告诉我如何隐藏菜单栏?如何隐藏标题栏?
- 如何解决Distinct不支持Text类型字段的问题(SQL Server)?
- c 语言和Delphi中的数据类型.
可以实现你的要求
//功能:取得指定年和月的最后一天。uses SysUtils;function GetEndDay(const iYear, iMonth: Integer): Byte;
var
DayTable: PDayTable;
begin
DayTable := @MonthDays[IsLeapYear(iYear)];
Result := DayTable[iMonth];
end;使用上面的函数,再与你的日期相比即可。