Icon View Thread

The following is the text of the current message along with any replies.
Messages 1 to 3 of 3 total
Thread Why can't a TEDBTable using a TField, be able to store seconds into an EDB TimeStamp column?
Sat, Nov 8 2014 6:48 PMPermanent Link

Barry

I have a Delphi XE2 (Unicode) app and an EDB v2.13B2 (Unicode) database and when I set a TField that is DateTime to something with seconds, like 11/3/2003 1:00:01, and save the EDB record, the TField.Value, it is correctly shown in the debugger as "11/3/2003 1:00:01" but the value stored in the database is "2003-11-03 1:00". It is missing the seconds ":01". Why?

I can manually enter the timestamp in the same column using EDBMgr just fine. But a Delphi TField won't save the seconds for the TimeStamp column.

My application is using TEDBTables and I don't want to have to update the row using SQL.
Has anyone else noticed this problem with TEDBTable and TimeStamp columns?

TIA
Barry
Sun, Nov 9 2014 6:46 AMPermanent Link

Adam Brett

Orixa Systems

Barry

I regularly save seconds in my Apps (Delphi XE2)  so it is not hard to do.

Very quick reply that is likely to only partly correct Smile....

I think you may have to change the TFormatSettings (or another similar property) of the TField to increase its accuracy.

EDB Timestamp is accurate to milliseconds, so I am sure that the problem is somewhere in the Delphi side of the code, not the EDB side.

Adam
Sun, Nov 9 2014 11:54 AMPermanent Link

Barry

Adam Brett wrote:

>I regularly save seconds in my Apps (Delphi XE2)  so it is not hard to do.<

Using TEDBTable?

>I think you may have to change the TFormatSettings (or another similar property) of the TField to increase its accuracy.<

Except in the debugger the TField.Value is correct, so the TField has the timestamp with the seconds in it. When the record is saved, EDBMgr shows no seconds yet the TField still has the seconds.

>EDB Timestamp is accurate to milliseconds, so I am sure that the problem is somewhere in the Delphi side of the code, not the EDB side.<
Correct. The problem is on the Delphi side of things, not the EDB server. I thought it might have to do with the EDB Delphi code that saves the TDateTime to the database (rounding?).

I will try to replicate the problem in a test database to see what happens.

Barry
Image