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程序将自身可执行文件拷贝到u盘的代码

Delphi 程序重新启动自身

Delphi 不重复运行外部程序exe

Delphi 泛型排序器 tcomparer

Delphi 中的md5实现方法及Delphi2009和Delphi2010中用法

Delphi驱动方式winio模拟按键

Delphi 收集了比较全的字符串进制转换

Delphi xe5 为android增加启动图片显示

Delphi保存网页中的图片

Delphi webbroker 上传文件

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



打赏

取消

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

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

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

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

评论

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