Data-aware controls and TIMESTAMP WITH LOCAL TIME ZONE

My application uses data-aware controls bound to database fields of type TIMESTAMP WITH LOCAL TIME ZONE.
When I READ data from the db, time values are displayed correctly i.e. in the Session Time Zone.
However, when I POST data to the db, time values are stored as if they were expressed in the Windows Time Zone
(set in the Windows Control Panel), which may differ from the Session Time Zone (set by ALTER SESSION statement in the application).
As a consequence, when the user modifies the minutes of a timestamp only and posts the changes,
the hours are changed as well.

Example:
Windows Time Zone = GMT + 2:00, Session Time Zone = GMT + 4:00
Database field contains time portion 13:00 GMT
Read from db -> data-aware control correctly displays 17:00
Edit control: change 17:00 into 17:10
Post -> database field contains 15:10 GMT and data-aware control displays 19:10

What should I do to make this work correctly?

Kind Regards,
Geert.
 
What is the value of the TOracleSession.Preferences.TimeStampAsString property? If set to True, timestamps are read and written in the string representation as defined in the NLS_TIMESTAMP_FORMAT or NLS_TIMESTAMP_TZ_FORMAT registry settings. If set to False, timestamps are read and written as standard date values.
 
TOracleSession.Preferences.TimeStampsAsString = FALSE (default value);
when I set it to TRUE, I get an error when loading a db record:
Could not convert variant of type (string) into type (double)
 
Hello,

I made use of TOracleSession.TimestampAsString:=True
and in an TOracle Dataset tried:

select
SYSTIMESTAMP as timestamp_sts
from dual

and got the timestamp as widestring.

The problem is that it comes in format:
12-JAN-18 10.26.23.350000 PM +01:00

Is there any way to control the format ?
Something that can replace the TDateTime's DisplayFormat?

best regards,
Altin

 
The timestamp format is controlled by the NLS_TIMESTAMP_FORMAT and NLS_TIMESTAMP_TZ_FORMAT settings of your Oracle Session.

You can set the formats in the Oracle Registry, in environment variables, or you can execute ALTER SESSION statements in your application.
 
Back
Top