delphi IncYear、IncMonth、IncWeek、IncDay、IncHour、IncMinute、IncSecond、IncMilliSecond �C 增时


本文整理自网络,侵删。

 

DateUtils.IncYear();
DateUtils.IncMonth();
DateUtils.IncWeek();
DateUtils.IncDay();
DateUtils.IncHour();
DateUtils.IncMinute();
DateUtils.IncSecond();
DateUtils.IncMilliSecond();

  unit Unit1;interfaceuses  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  t1,t2: TDateTime;  i: Int64;  d: Double;begin  t1 := StrToDateTime('2011-1-1 1:1:1');  t2 := IncYear(t1);  ShowMessage(DateTimeToStr(t2)); //2012-1-1 1:01:01  t2 := IncYear(t1, 3);  ShowMessage(DateTimeToStr(t2)); //2014-1-1 1:01:01  t2 := IncMonth(t1);  ShowMessage(DateTimeToStr(t2)); //2011-2-1 1:01:01  t2 := IncWeek(t1);  ShowMessage(DateTimeToStr(t2)); //2011-1-8 1:01:01  t2 := IncDay(t1);  ShowMessage(DateTimeToStr(t2)); //2011-1-2 1:01:01  t2 := IncHour(t1);  ShowMessage(DateTimeToStr(t2)); //2011-1-1 2:01:01  t2 := IncMinute(t1);  ShowMessage(DateTimeToStr(t2)); //2011-1-1 1:02:01  t2 := IncSecond(t1);  ShowMessage(DateTimeToStr(t2)); //2011-1-1 1:01:02  t2 := IncMilliSecond(t1);  ShowMessage(FormatDateTime('yyyy-m-d h:n:s:zzz', t2)); //2011-1-1 1:01:01:001end;end.

相关阅读 >>

Delphi 取得某一天所在的星期一及星期天

Delphi 网址链接提取域名

Delphi实现win10下Delphi 10.3.1 inline hook 调试器法获取寄存器并修改

Delphi xe 利用fmx控件的makescreenshot过程实现wait效果

Delphi cb_addstring 与lb_addstring的区别?

Delphi2010 关于record类型rtti反射的用途和方法

Delphi-adoquery查询、插入、删除、修改

Delphi判断ie是否使用代理

Delphi setprivilege 提权代码

Delphi中启用禁止cd驱动器自动运行播放

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



打赏

取消

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

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

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

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

评论

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

    正在狠努力加载,请稍候...