Mysql timestamp in milliseconds
Mysql timestamp in milliseconds
How to get the current time from the MYSQL server in milliseconds? I only get it in whole seconds.
Re: Mysql timestamp in milliseconds
To get a value with milliseconds you can use the following code:
Code: Select all
var
ms: Integer;
begin
UniQuery.SQL.Text := 'SELECT NOW(3)';
UniQuery.Open;
ms := UniQuery.Fields[0].AsSQLTimeStamp.Fractions;Re: Mysql timestamp in milliseconds
Thanx but i cant get it to work:
Code: Select all
procedure TForm7.Button7Click(Sender: TObject);
var
ms : Integer;
q :TUniQuery;
begin
q:=TUniQuery.Create(nil);
q.Connection:=MainCon;
q.SQL.Text := 'SELECT NOW(3)';
q.Open;
ms := q.Fields[0].AsSQLTimeStamp.Fractions;
Memo1.Lines.Add(IntToStr(ms));
q.Free;
end;Re: Mysql timestamp in milliseconds
Please provide the exact versions of the used MySQL Server and IDE. Also specify whether the ms variable value equals 0.
Re: Mysql timestamp in milliseconds
Yes it returns 0ViktorV wrote:Please provide the exact versions of the used MySQL Server and IDE. Also specify whether the ms variable value equals 0.
Mysql 5.5.45
Delphi 10.2
Unidac 7.0.1
Re: Mysql timestamp in milliseconds
This behavior occurs due to MySQL 5.5.45 architecture specificity, but not UniDAC functionality. Before MySQL version 5.6.4, MySQL does not support milliseconds (more precise: fractional seconds) in TIME, TIMESTAMP and DATETIME: https://dev.mysql.com/doc/refman/5.6/en ... conds.html