[Lazarus] Alternative to getTime() of JavaScript

silvioprog silvioprog at gmail.com
Sat Sep 24 01:13:13 CEST 2011


2011/9/23 Alberto Narduzzi <albertonarduzzi at yahoo.com>:
> First of all, Silvio, it's amazing how you can formulate questions and
> answers all by yourself ;-)

:D

> then, I think you should replace the 08:00:00 with a more suitable
> 00:00:00...

Yes, I made:

uses
  DateUtils;

var
  Since19700101: TDateTime;

function getTime: Int64;
begin
  Result := MilliSecondsBetween(Since19700101, Now);
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
  Caption := IntToStr(getTime);
end;

initialization
  Since19700101 := EncodeDate(1970, 1, 1);

>
>> MilliSecondsBetween(StrToDateTime('1970-01-01 08:00:00'), now);
>
>
> Cheers, A.

Thx.

-- 
Silvio Clécio
===============================================
Blog - <silvioprog.com.br>
Twitter - <twitter.com/silvioprog>
Facebook - <facebook.com/silvioprog>
LazSolutions - <code.google.com/p/lazsolutions>
LazWebSolutions - <code.google.com/p/lazwebsolutions>
Lazarus-BR - <groups.google.com.br/group/lazarus-br?hl=pt-BR>
===============================================
   * Conheça nosso canal IRC sobre Lazarus: #lazarus-br *
===============================================




More information about the Lazarus mailing list