uses DateUtils;
function dwDateToPHPDate(ADate:TDateTime):string;
var
f1970 : TDateTime;
begin
//PHP时间是格林威治时间1970-1-1 08:00:00到当前流逝的秒数
f1970 := EncodeDateTime(1970, 1, 1, 8, 0, 0, 0);//StrToDateTime('1970-01-01 00:00:00');
//
Result :=inttostr( Round((ADate - f1970)*24*3600));
//Result := ((ADate+28800)/86400+25569);
end;
memo1.text:=dwDateToPHPDate(VarToDateTime('2022-02-14 21:59:29'));
Copyright © 2014 DelphiW.com 开发 源码 文档 技巧 All Rights Reserved
晋ICP备14006235号-8 晋公网安备 14108102000087号
执行时间: 0.036439180374146 seconds