DateTime format

phoenix610

Member²
Oh, I have posted three topics at a time.

I want to ask you about DateTime format.

I have a table with both date field and timestamp field. But, these fields are diplayed
at a different format.

a date field is displayed like this.

'2005/09/01 12:10:15'

In this case, a display format of a date field depends on Windows locale settings.

a timestamp field is displayed like this.

'05-09-01 12:10:15.422000000'

In this case, a display format of a timestamp field igores Windows locale settings.
(TOracleSession.Preferences.TimestampAsString is true.)

If I want to display these values at the same format,
I have to re-parse values myself and display values?
Becaue my application allows a end-user to input the SQLStatement dynamically, it is hard works to specify the timestamp fields. I use not TOracleQuery but TOracleDataSet that does'nt have DOA FieldType() methods.

Thanks a lot.
 
The date field is displayed in the windows date/time format by the data-aware control.

The timestamp is displayed in the NLS_TIMESTAMP_FORMAT or NLS_TIMESTAMP_TZ_FORMAT, as defined in the Oracle registry.

You can either ensure that the registry values match the windows date/time format, or execute an "alter session set nls_timestamp_(tz_)format" command.
 
Hello.

I didn't know that the timestamp filed is diplayed in the nls parameters.

I have one more question.

I want to know the original Oracle data types of the TOracleDataSet.Is there ways anything?

Using TOracleQuery, I can distinguish from themselves because it has FieldType() or DBFieldType method.But TOracleDataSet does'nt have these methods.

I'm sorry for my poor English.

Thanks.
 
For a TOracleDataSet you cannot directly get the DBFieldTypes.

The work around is to derive your own class from TOracleDataSet and access the InternalQuery function. This returns the TOracleQuery instance that is used when you open the dataset. It is a protected function, so only descendants can access it:

Code:
TmpOracleDataSet = class(TOracleDataSet)
end;
After that, you can typecast a TOracleDataSet to get access to InternalQuery:

Code:
OracleDataSet.Open;
OracleQuery := TmpOracleDataSet(OracleDataSet).InternalQuery;
for i := 0 to OracleQuery.FieldCount - 1 do ...
 
Yes.

To access protected members by inheriting is
called Crack at Borlad site, I hear.

That's all.

I'm sorry. My experssion misled(misunderstood) you.
 
Back
Top