码迷,mamicode.com
首页 > Windows程序 > 详细

Delphi 字符串转日期,强大到窒息,困扰了很久

时间:2018-08-14 17:07:48      阅读:257      评论:0      收藏:0      [点我收藏+]

标签:函数   操作   字符   var   text   行数据   art   roc   procedure   

procedure THRForm.Button1Click(Sender: TObject);
var
  D:TDateTime;
  s:string;
begin
  D:=VarToDateTime(05-10-14 04:35PM);
  S:=FormatDatetime(YYYY-MM-DD HH:MM:SS,D);
  showmessage(s);
end;

 

尤其是在进行数据库语句操作时,对于字符串的来源不确定因素太多,有了该函数用起来真的很方便。举例如下:

FQuery.Parameters.ParamValues[Brithday]  := IfThen(edit1.Text= ‘‘, VarToStr(Null), VarToDateTime(edit1.Text));

 

Delphi 字符串转日期,强大到窒息,困扰了很久

标签:函数   操作   字符   var   text   行数据   art   roc   procedure   

原文地址:https://www.cnblogs.com/mobilecard/p/9475369.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!