delphi:
获取10位时间戳
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
Str := IntToStr(DateTimeToTimeStamp(Now).Date) + '' + IntToStr(DateTimeToTimeStamp(now).time);
ShowMessage(InttoStr(DateTimeToUnixDate(now)));
end;
获取毫秒级时间戳
procedure TForm1.btn4Click(Sender: TObject);
begin
Str := IntToStr(DateTimeToTimeStamp(Now).Date) + '' + IntToStr(DateTimeToTimeStamp(now).time);
ShowMessage(Str);
end;