procedure TForm1.btn4Click(Sender: TObject); var Str :String; D :tDatetime; a:Double; function DateTimeToUnixDate(const ADate: TDateTime): Longint; const cUnixStartDate: TDateTime = 25569.333; // 1970/01/01 begin Result := Round((ADate - cUnixStartDate) * 86400); end; begin // D := StrToDateTime('2019-11-26 17:18:53'); // a := D-18226.3881134; // ShowMessage(FloatToStr(a)); Str := IntToStr(DateTimeToTimeStamp(Now).Date) + '' + IntToStr(DateTimeToTimeStamp(now).time); //Str := IntToStr(DateTimeToTimeStamp(now).Date); ShowMessage(InttoStr(DateTimeToUnixDate(now)));
end;
|
请发表评论