本文整理自网络,侵删。
声明:const MonthDays : array [Boolean] of TDayTable =
((31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31),
(31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31));
描述:MonthDays常量是SysUtils单元中比较有用的部分,它给出了一个月有多少天。如果一个闰年(第一个数组参数Boolean为True)的2月分,它返回29。
begin
// 2000年2月份有多少天?
ShowMessage('Days in February 2000 = '+
IntToStr(MonthDays[IsLeapYear(2000)][2]));
end;
程序运行结果: Days in February 2000 = 29
相关阅读 >>
Delphi blockread和blockwrite读写文件
Delphi中调用api函数exitwindowsex可以实现系统的关机,注销,和重启
Delphi 解决idtcpclient和idtcpserver通信中文乱码问题
更多相关阅读请进入《Delphi》频道 >>