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 获取用户当前的windows临时文件夹

vclzip控件显示压缩进度

Delphi tms web core twebsocketclient

Delphi 关于 class helper for ... 语法

Delphi webbrowser 跨域访问

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

Delphi 判断字符串是否相同

Delphi 创建一个文本文件

Delphi屏蔽webbrowser页面中传出来的声音

Delphi 提权,杀进程,删服务

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



打赏

取消

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

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

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

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

评论

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