delphi 构建时间 -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;interfaceuses  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-20end;end.

相关阅读 >>

Delphi 任务管理器 获取窗口标题 获取窗口图标

Delphi 判断tcp端口是否被占用的方法

Delphi 获取本机 hostname ip address

Delphi urunpe

Delphi 单元文件结构

Delphi根据窗口句柄获取所在程序路径

Delphi中使用ado连接带密码的access

Delphi 如何得到动态链接库的输出函数tdump命令

Delphi实现win10下Delphi 10.3.1 inline hook 修改mac网卡地址之getadaptersaddresses

Delphi webbrowser 无法调用当前浏览器的版本

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



打赏

取消

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

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

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

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

评论

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