zoukankan      html  css  js  c++  java
  • EncodeDateTime ... TryEncodeDateTime ... 构建时间

    SysUtils.EncodeDateTime
    SysUtils.EncodeDate
    SysUtils.EncodeTime
    
    DateUtils.EncodeDateDay
    DateUtils.EncodeDateMonthWeek
    DateUtils.EncodeDateTime
    DateUtils.EncodeDateWeek
    DateUtils.EncodeDayOfWeekInMonth
    
    DateUtils.TryEncodeDateTime
    DateUtils.TryEncodeDateDay
    DateUtils.TryEncodeDateWeek
    DateUtils.TryEncodeDateMonthWeek
    DateUtils.TryEncodeDayOfWeekInMonth
    

    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;
    
    type
      TForm1 = class(TForm)
        Memo1: TMemo;
        procedure FormCreate(Sender: TObject);
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    uses DateUtils;
    
    procedure TForm1.FormCreate(Sender: TObject);
    var
      t: TDateTime;
      s: string;
    begin
      t := EncodeDateTime(2009, 5, 20, 11, 22, 33, 999);
      s := FormatDateTime('yyyy-m-d h:n:s:zzz', t); //2009-5-20 11:22:33:999
    
      t := EncodeDate(2009, 5, 20);
      s := FormatDateTime('yyyy-m-d h:n:s:zzz', t); //2009-5-20 0:0:0:000
    
      t := EncodeTime(11, 22, 33, 999);
      s := FormatDateTime('h:n:s:zzz', t);          //11:22:33:999
    
      t := EncodeDateDay(2009, 140);
      s := FormatDateTime('yyyy-m-d', t);           //2009-5-20
    
      t := EncodeDateWeek(2009, 21);
      s := FormatDateTime('yyyy-m-d', t);           //2009-5-18
      t := EncodeDateWeek(2009, 21, 3);
      s := FormatDateTime('yyyy-m-d', t);           //2009-5-20
    
      t := EncodeDateMonthWeek(2009, 5, 3, 3);
      s := FormatDateTime('yyyy-m-d', t);           //2009-5-20
    
      t := EncodeDayOfWeekInMonth(2009, 5, 3, 3);
      s := FormatDateTime('yyyy-m-d', t);           //2009-5-20
    
      if TryEncodeDateTime(2009, 5, 20, 11, 22, 33, 999, t) then
        s := FormatDateTime('yyyy-m-d h:n:s:zzz', t);      //2009-5-20 11:22:33:999
    
      if TryEncodeDateDay(2009, 140, t) then
        s := FormatDateTime('yyyy-m-d', t);                //2009-5-20
    
      if TryEncodeDateWeek(2009, 21, t) then
        s := FormatDateTime('yyyy-m-d', t);                //2009-5-18
    
      if TryEncodeDateMonthWeek(2009, 5, 3, 3, t) then
        s := FormatDateTime('yyyy-m-d', t);                //2009-5-20
    
      if TryEncodeDayOfWeekInMonth(2009, 5, 3, 3, t) then
        s := FormatDateTime('yyyy-m-d', t);                //2009-5-20
    end;
    
    
    end.
    


    DateUtils-Function
  • 相关阅读:
    linux | 一次网卡故障处理
    KVM | centos 安装 window 虚拟机
    DNS | named.run文件很大的处理方法
    01
    802.11X用户身份验证
    802.11有线等效加密WEP
    802.11成帧细节
    802.11 MAC基础
    【转载】我为什么放弃了 Linux 内核学习?
    Linux网络编程(一):一个简单的socket程序
  • 原文地址:https://www.cnblogs.com/del/p/1473157.html
Copyright © 2011-2022 走看看