delphi 日期加减


本文整理自网络,侵删。

 
function AddDays(const DateTime: TDateTime; const Days: Integer): TDateTime;
begin
  Result := DateTime + Days;
end;

function SubtractDays(const DateTime: TDateTime; const Days: Integer): TDateTime;
begin
  Result := DateTime - Days;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
caption:=datetimetostr(AddDays(date,1)); //加1天
caption:=datetimetostr(SubtractDays(date,1));  //减1天
end;

相关阅读 >>

Delphi 强迫将半型英数字转换成全型英数字

Delphi读写utf-8、unicode格式文本文件

Delphi cpu窗口的扩展学习

Delphi用代码实现注册ocx和dll

Delphi httpserver 使用方法

获取剪贴板文字内容的代码

Delphi 比较两个位图是否相同

Delphi中sendmessage详细资料

Delphi sysutils.trim、sysutils.trimleft、sysutils.trimright - 删除空格

Delphi获取本机mac地址方法

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



打赏

取消

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

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

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

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

评论

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