Problem with MySQL time values

Discussion of open issues, suggestions and bugs regarding MyDAC (Data Access Components for MySQL) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
snorkel
Posts: 384
Joined: Tue 08 Aug 2006 15:10
Location: Milwaukee WI USA

Problem with MySQL time values

Post by snorkel » Tue 13 May 2008 16:55

Give the query below:

Select TIMEDIFF('1997-12-31 23:59:59.000001','1997-12-30 01:01:01.000002');

it should return:
46:58:57

but when I run it with the Quantum Grid it displays as:
22:58:57

I believe this is because the delphi ttime object won't dispaly more than 24 hours, but I am not sure.

I am not sure if this is a grid issue or if the Mydac query should be mapping it to a string type instead of a ttime type.

Dimon
Devart Team
Posts: 2910
Joined: Mon 05 Mar 2007 16:32

Post by Dimon » Fri 16 May 2008 11:56

The Delphi Time object doesn't allow keeping time more than 24 hours. If you want to work with larger time you can get data as string and process it yourself.
For this you can use the following query:

Code: Select all

Select CAST(TIMEDIFF('1997-12-31 23:59:59.000001','1997-12-30 01:01:01.000002') AS CHAR);

Post Reply