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

Mailing lists / fpc-pascal / 2007-06
7 messages · 5 people · –
Reply by email Subscribe to this list Your subscription
Read-only archive. Use j and k to move between messages.
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
See the dateutls unit provided by FPC.
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 :
Many thanks patrick i will try it !
Dear Is there a function that help me to calculate seconds since 1970 year ? exactly the…
this will do what you want?:
function LocalToEpoch(
year: Word;
month: Word;
day: Word;
hour: Word;
minute: Word;
second: Word
):LongInt;henry
You can do that with ? MilliSecondsBetween<http://lazarus-ccr.sourceforge.net/fpcdoc/rtl/d…
patrick feillant wroteMilliSecondsBetween<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 ?
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;