On Tue, 4 Apr 2006, Arí Ricardo Ody wrote:


If you think carefully you'll conclude that there is only one type of TIMESTAMP: day, month, year, hours, minutes, seconds and 1/1e6 of seconds. All other types are derived from this format, the complete TIMESTAMP format.

This is theory. In practice, each DB engine stores this information in
a different format (or several formats, as in the case of DB2), and
even worse, returns it in yet another format.

I(we?) was talking about DB2. Several formats? You're right. But the complete information(that can be represented in several formats) MUST have the fields I explained above, at least.

So does TDateTime. That is it's purpose.

To offer the pascal programmer a UNIFORM interface, which is the same
across all DB engines, all dates are represented as a TDateTime value.

I understand this. But, if each RDBMS has its own format I think that a little flexibility is welcome.

Exactly: TDateTime is the same. always. and there are enough conversion
routines to output it in any format you want.

The opposite is NOT true: if you get a string, there is no way, in
program code, to determine with 100% certainty what format it is in.

Regardless of the internal format of TDateTime, using a text value
is definitely out, because then you will be stuck with different
date notations. Not to mention that it takes more memory to store
it as text, and this is also bad.

The different notations use, all of the fields above, in different orders. Or no? You may customize the ODBC(IBM DB2 ODBC has formats ISO, EUROPE, USA...) to attend these different formats. I only suggest one format. You may change order of the fields as the users request.

No.

No format, this is the whole point of using TDateTime: it is locale-agnostic.

One or two bytes more to give clarity... If you consider the size of memories available...(I remember a conversation about prologs and epilogs, somedays ago :-X )

To avoid all these issues, we use TDatetime, with less space.

A conversion must be done _anyway_ , and TDateTime is always defined
identically, irrespective of the OS/DB/whatever locale settings.

It's TDateTime, it has always been so, and it will remain so.
I can try to explain why it is the way it is, but it won't be changed.

Michael.

Reply via email to