zoukankan      html  css  js  c++  java
  • IncYear、IncMonth、IncWeek、IncDay、IncHour、IncMinute、IncSecond、IncMilliSecond 增时

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

    unit Unit1;
    
    interface
    
    uses
      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:001
    end;
    
    end.
    


    DateUtils-Function
  • 相关阅读:
    第十一单元 beego验证
    第九单元 ORM
    第六单元 go操作redis
    第五单元 go操作mysql
    第四单元 参数配置
    springboot使用外置tomcat
    ⚡ 第二.三章顺序表与链表⚡
    c语言程序设计题 译密码
    翁恺 java进阶第一周作业
    Java 构造素数表的两种方法
  • 原文地址:https://www.cnblogs.com/del/p/1468885.html
Copyright © 2011-2022 走看看