How to get the millisecond value from a Timestamp field in firebird with Delphi 2007

社会主义新天地 提交于 2019-12-05 10:31:15

I don't know if Firebird actually supports milliseconds, but I know for a fact that the InterBase driver for Delphi 2007 does not. This is because InterBase does not return milliseconds in its C API; although InterBase stores DateTimes to sub-milliseconds precision, the InterBase API returns times in a C TM struct which does not contain a millisecond field. Therefore, the dbExpress driver designed for InterBase is not going to support that. So, you will need to change drivers at a minimum, presuming that Firebird actually supports this at all.

A colleague of mine (Edwin van der Kraan) just checked: it works with FIBplus!

He checked with FIBPlus version 6.9.6 and Firebird 2.1.1.

He inserte a current_timestamp insert, and extracted it with FormatDateTime('dd-mm-yyyy hh:nn:ss:zzz', TestpFIBDataSetMYDATE.Value) Then he got back the date and time including milliseconds.

--jeroen

Firebird FAQ #305 explains how to easily work around this via simple varchar CAST.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!