Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2007-06

Get Timestamp since 1970 (linux)

7 messages · 5 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

TOUZEAU DAVID

Dear

Is there a function that help me to calculate seconds since 1970 year ?

exactly the same of this command :

/bin/date +%s -d 20070103

best regards

David Touzeau -------------------------- Linux Ubuntu Dapper 6.0.6 FreePascal-Lazarus,perl,delphi,php icq:160018849

Reply by email

Catalin Zamfir Alexandru
to TOUZEAU DAVID

See the dateutls unit provided by FPC.

TOUZEAU DAVID wrote 9 lines
Dear Is there a function that help me to calculate seconds since 1970 year ? exactly the same of this command : /bin/date +%s -d 20070103 best regards

Reply by email

patrick feillant
to TOUZEAU DAVID: Dear Is there a function that help me to calculate seconds since 1970 year ? exactly the…

Hello,
You can do that with ?

MilliSecondsBetween<http://lazarus-ccr.sourceforge.net/fpcdoc/rtl/dateutils/millisecondsbetween.html>

Calculate the number of whole milliseconds between two DateTime values.

between encodedatetime(1970,1,1,0,0,0,0) and Present

I don't test, but it's probably ok.

bye

2007/6/4, TOUZEAU DAVID :

Show quoted text 19 lines
Dear Is there a function that help me to calculate seconds since 1970 year ? exactly the same of this command : /bin/date +%s -d 20070103 best regards -- David Touzeau -------------------------- Linux Ubuntu Dapper 6.0.6 FreePascal-Lazarus,perl,delphi,php icq:160018849 _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Reply by email

TOUZEAU DAVID
to patrick feillant

Many thanks patrick i will try it !

patrick feillant wrote 45 lines
Hello, You can do that with ? MilliSecondsBetween <http://lazarus-ccr.sourceforge.net/fpcdoc/rtl/dateutils/millisecondsbetween.html> Calculate the number of whole milliseconds between two DateTime values. between encodedatetime(1970,1,1,0,0,0,0) and Present I don't test, but it's probably ok. bye 2007/6/4, TOUZEAU DAVID < >: Dear Is there a function that help me to calculate seconds since 1970 year ? exactly the same of this command : /bin/date +%s -d 20070103 best regards -- David Touzeau -------------------------- Linux Ubuntu Dapper 6.0.6 FreePascal-Lazarus,perl,delphi,php icq:160018849 _______________________________________________ fpc-pascal maillist - http://lists.freepascal.org/mailman/listinfo/fpc-pascal
David Touzeau -------------------------- Linux Ubuntu Dapper 6.0.6 FreePascal-Lazarus,perl,delphi,php icq:160018849

Reply by email

Henry Vermaak
to TOUZEAU DAVID: Dear Is there a function that help me to calculate seconds since 1970 year ? exactly the…
TOUZEAU DAVID wrote 8 lines
Dear Is there a function that help me to calculate seconds since 1970 year ? exactly the same of this command : /bin/date +%s -d 20070103

this will do what you want?:

function LocalToEpoch(
  year: Word;
  month: Word;
  day: Word;
  hour: Word;
  minute: Word;
  second: Word
):LongInt;
Show quoted text 5 lines
best regards -- David Touzeau -------------------------- Linux Ubuntu Dapper 6.0.6

henry

Reply by email

TOUZEAU DAVID
to Seweryn Walentynowicz

Many thanks Seweryn, i use it

var ANow,AThen : TDateTime;
begin
      ANow:=now;
      AThen:=EncodeDateTime(1970, 1, 1, 0, 0, 0, 0);
      result:=IntTostr(SecondsBetween(ANow,AThen)-7200);//7200 for GMT +2
end;
Seweryn Walentynowicz wrote 14 lines
On Mon, Jun 04, 2007 at 09:27:55AM +0200, patrick feillant wrote: > MilliSecondsBetween<http://lazarus-ccr.sourceforge.net/fpcdoc/rtl/dateutils/millisecondsbetween.html> > > Maybe simpler Secondsbetween() ? :o) > 2007/6/4, TOUZEAU DAVID : > >> Is there a function that help me to calculate seconds since 1970 year ? >>
David Touzeau -------------------------- Linux Ubuntu Dapper 6.0.6 FreePascal-Lazarus,perl,delphi,php icq:160018849

Reply by email