Delphi DaysBetween 用法片段


本文整理自网络,侵删。

 


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 edit右键系统菜单加自定义菜单项

Delphi 获取局域网内的机器名

Delphi中datetimepicker组件介绍

Delphi winexec 执行cmd

unigui js操作Delphi控件赋值

Delphi 窗体的位置和高宽度-tform:letf、top、width、height、clientwidth、clientheight

如何将string变量赋值给pchar变量

Delphi rest服务器返回图像并显示在浏览器中

Delphi inifile to xml

Delphi里formatfloat的用法

更多相关阅读请进入《Delphi》频道 >>



打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...