Y2K Problems?

Ernie

Member
I have problems where the TOraclePackage Component. Can somebody help ?

I call a procedure with CallProcedure method of TOraclePackage. This Procedure has 2 parameters : a Date and a Integer.

If the short date format on my Regional Settings of Control Panel have 'MM/dd/yyyy', the procedure works well. But if the format is 'MM/dd/yy' the procedure writes data like this : '01/03/1900' instead of '01/03/2000'.

Please Help. Microsoft says its not necessary to change the format and there are a lot of users in many countries....
 
The TOraclePackage does not have a Y2K problem. For dates it uses a TDateTime data type, which is not affected by the regional settings. If, however, you pass strings to date parameters or dates to string parameters, then you get implicit conversions between strings and dates. You are then depending on the regional settings of windows and the nls_date_format settings of the Oracle session.

You should always treat dates as dates in your application, and only convert to/from strings when they are represented on screen or in a file.

------------------
Marco Kalter
Allround Automations
 
If you havce stored procedures and packages that use a string entry to get a date and do not want to or can not take the time to change the date, you can convert windows dates to Y2K strings using the following Delphi function:
strDate := formatDateTime( 'dd"/"mm"/"yyyy', DatePicker.Date);
The choice of the formatting string - 'dd"/"mm"/"yyyy' is up to you, but be sure it matches your expectations in Oracle.
 
Back
Top