A
A
Alex Alex2016-09-15 20:59:02
Delphi
Alex Alex, 2016-09-15 20:59:02

How to formulate Unix in Delphi?

I use function

UnixStartDate: TDateTime = 25569.0;

function DateTimeToUnix(ConvDate: TDateTime): Longint;
begin
  Result := Round((ConvDate - UnixStartDate) * 86400);
end;

I get: 1473978988
and I need: 1470518278402
ShowMessage(inttostr(DateTimeToUnix(Now)));
it also gives out 10 digits, when you need 13
, can someone tell me the function

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maximw, 2016-09-16
@maximw

DateUtils.MilliSecondsBetween(ConvDate, 0);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question