根据年月可以推出每月的日期数,这个算法怎么写啊?
解决方案 »
- TLABEL的事件怎么屏蔽?
- 从数据库读取数据添加到树形控件上~~~有适合答案我再加分~~~~~~~~标题不要太长~~~~~~~~~~~~~~~~~~~~~~~~~~~~~希望答案能详细些!
- 怎样使对话框中的文字信息可以带变量字符串?
- 急,求adoconnection动态连接到link.udl文件的方法.具体问题如下.
- 怎么将程序自己添加到系统启动中,又怎么移出呢??
- 关于TMemoryStream的两个问题!
- 小第在此问一个ASP的问题。详情请看这本来简单,可我是初学者所以在此向大家提出
- 如何清理Uses 里面使用的单元?
- delphi 用VMP加密,加入asm,64位报错,32位没问题,有解决办法吗?
- sqlite数据库中,我想用insert into 语句插入blob字段的记录数据。请高手救命
- dbgrid1的第一列是主键,如何在添加修改数据时,保证这列的值不重复和不为为空,否则出错
- 动态生成image的问题,急,请大家帮忙!
//DEMO: GetMonthDays(1996,2):=28function GetMonthDays(Y, M: Integer): integer;
const
sMonth: array[1..12] of Integer = (31, 28, 31, 30, 31, 30, 31,
31, 30, 31, 30, 31);
begin
Result := 0;
if (M < 1) or (M > 12) then Exit;
Result := sMonth[M];
if (M = 2) and IsLeapTrue(Y) then
Inc(Result)
end;
//DEMO: if IsLeapTrue(1996)=True then ..function IsLeapTrue(Y: integer): boolean;
begin
Result := ((Y mod 4 = 0) and ((Y mod 100 <> 0) or (Y mod 400 = 0)))
or (((Y mod 4) = 0) and ((Y mod 100) = 0) and ((Y mod 400) = 0));
end;
不需要甚末算法,有daysof()函数。//记得不是很清楚,可能是dayof daysin ...,自己看一下delphi的帮助。例:
2003年8月temp_data:='2003-08-'+'1'; //当月第一天
MonthDays=daysof(strtodate(temp_data)); //当月的天数
//Return the count of days in a month
//Copy Right 549@11:48 2003-8-7
begin
Result := DayOf( EndOfTheMonth( theDay ) );
end;
鉴别CSDN星星的含金量http://expert.csdn.net/Expert/topic/2147/2147062.xml?temp=.9299433