本文整理自网络,侵删。
IsLeapYear、IsInLeapYear - 是否是闰年
SysUtils.IsLeapYear();
DateUtils.IsInLeapYear();
--------------------------------------------------------------------------------
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TForm1 = class(TForm)
procedure FormCreate(Sender: TObject);
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
uses DateUtils;
procedure TForm1.FormCreate(Sender: TObject);
var
b: Boolean;
begin
b := IsLeapYear(2009); //False
b := IsLeapYear(2012); //True
b := IsInLeapYear(StrToDateTime('2009-1-1')); //False
b := IsInLeapYear(StrToDateTime('2012-1-1')); //True
// ShowMessage(BoolToStr(b, True));
end;
end.
相关阅读 >>
Delphi 用 directshow 获取本机的视频摄像设备列表
更多相关阅读请进入《Delphi》频道 >>