本文整理自网络,侵删。
uses DateUtils ;
procedure TForm1.FormCreate(Sender: TObject);const Birthday: TDate = 33208; //定义一个日期型常量 1990/12/1 caption:=FormatDateTime('dd/mm/yyyy',Birthday);var aDate: TDateTime; //定义一个日期时间型变量 s: string;begin
aDate := Now(); //获取今天的日期 s := '今天是 ' + FormatDateTime('yyyy 年 M 月 d 日。',aDate) + #13#10 + #13#10 + '你出生于 ' + FormatDateTime('yyyy 年 M 月 d 日。',Birthday) + #13#10 + #13#10 + '恭喜你!你在地球上已经生活了 ' + IntToStr(DaysBetween(aDate,Birthday)) + ' 天!'; MessageBox(Handle, PChar(s) ,'信息提示', MB_OK + MB_ICONINFORMATION);
end;
相关阅读 >>
Delphi 窗体的位置和高宽度-tform:letf、top、width、height、clientwidth、clientheight
更多相关阅读请进入《Delphi》频道 >>