Home > Back-end >  Delphi access mysql server time
Delphi access mysql server time

Time:10-07

Form1. MyQuery1. SQL. The Clear;
Form1. MyQuery1. SQL. The Add (' SELECT TIMESTAMPDIFF (SECOND, now (), 'the 2013-12-01 22:50:25)');
Try
Form1. MyQuery1. Execute;
Timediff:=// how to put on a query results in the timediff?
Except,
Form1. Memo2. Lines. The Add (' query server time error! ');
end;

Time_ser read from the database record time,

thank you

CodePudding user response:

The begin
Form1. MyQuery1. SQL. The Clear;
Form1. MyQuery1. SQL. The Add (' select ` time ` from ` monitor_system `. ` 666 master_pridata ` order by ` number ` desc limit 1 ');
Try
Form1. MyQuery1. Execute;
Time_ser:=Form1. MyQuery1. FieldByName (' time '). AsString;
Except,
Form1. Memo2. Lines. The Add (' query the database error time! ');
end;

Form1. MyQuery1. SQL. The Clear;
Form1. MyQuery1. SQL. The Add (' SELECT TIMESTAMPDIFF (SECOND, now (), time_ser) ');
Try
Form1. MyQuery1. Execute;
Timediff:=Form1 MyQuery1//??????
Except,
Form1. Memo2. Lines. The Add (' query server time error! ');
end;

end;

CodePudding user response:

Form1. MyQuery1. SQL. The Clear;
S:='SELECT TIMESTAMPDIFF (SECOND, now (),' '+ time_ser +' ' ') as time1 ';
Form1. MyQuery1. SQL. The Add (s);

Try
Form1. MyQuery1. Execute;
Timediff:=Form1. MyQuery1. Fieldbyname (' time1). AsString;
Except,
Form1. Memo2. Lines. The Add (' query server time error! ');
end;
Result:=timediff;

Ha ha, solve, ha ha, let you laughed,

CodePudding user response:


Whether to individual points ah,, ha ha

CodePudding user response:

pick up points!! Pick up points!!!!!!
  • Related