BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

BDE Century Date problem

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.databases
View previous topic :: View next topic  
Author Message
Utah Jeff
Guest





PostPosted: Tue May 16, 2006 9:22 pm    Post subject: BDE Century Date problem Reply with quote



I have a client that is running a program written in D5 and using BDE
5.01 running on XP home. We do not have access to the source code.
There are only 2 digits available for the birth year. When they enter
41 for 1941 the system stores it as 2041. I looked at the BDE Init
settings and tried all combinations of FOURDIGITYEAR and YEARBIASED.
I keep seeing references to changing a Windows date format. Is there a
fix for this problem since we do not have the source code? Where is
the Windows date format setting they are talking about?
Back to top
DB-1
Guest





PostPosted: Wed May 17, 2006 9:22 am    Post subject: Re: BDE Century Date problem Reply with quote



Utah Jeff wrote:
Quote:

I looked at the BDE Init
settings and tried all combinations of FOURDIGITYEAR and YEARBIASED.
I keep seeing references to changing a Windows date format. Is there a
fix for this problem since we do not have the source code? Where is
the Windows date format setting they are talking about?

The first thing is to peek what is actually stored to the Paradox/dBase
database field. The BDE programmer's way to see inside database files is
to use the Database Desktop application that comes with Delphi
development environment.

But if you do not have Delphi, you do not have access to that tool. Then
you could use some free replacement tool like this for instance
http://prdownloads.sourceforge.net/jedidbd/jedidbd_install_0.2.0.0.exe?download

If your application has internal program fault that makes some
calculations with two year digits, and then stores a wrong century to
the database, then there's not much you can do, but to abandon the
application. Or to find a skillfull hacker who possibly could hack the
EXE file, but this is not likely.

Date/Time values can be stored as a Float number, and Date values as
Integer numbers to some numeric DB field, and the programmer could have
used these tricks also. Then your Database Desktop tool may not even
find a Date Field that would look like a Date at all, like 17 May 2006,
but a integer representation 732448 of that date.

Of course, if you are lucky you could find some Win/BDE setting that
turns everything back to order again.

DB-1
Back to top
Dan
Guest





PostPosted: Thu May 18, 2006 5:22 pm    Post subject: Re: BDE Century Date problem Reply with quote



On 16 May 2006 13:23:57 -0700, "Utah Jeff" <jfullmer (AT) gmail (DOT) com> wrote:

Quote:
I have a client that is running a program written in D5 and using BDE
5.01 running on XP home. We do not have access to the source code.
There are only 2 digits available for the birth year. When they enter
41 for 1941 the system stores it as 2041. I looked at the BDE Init
settings and tried all combinations of FOURDIGITYEAR and YEARBIASED.
I keep seeing references to changing a Windows date format. Is there a
fix for this problem since we do not have the source code? Where is
the Windows date format setting they are talking about?

Here is some more background info which might help:
from the Delphi Help file

TwoDigitYearCenturyWindow Determines what century is added to
two-digit years when string dates are converted to numeric dates with
StrToDate or StrToDateTime The value of TwoDigitYearCenturyWindow, if
it is nonzero, is subtracted from the current year to calculate the
floating “pivot” prior to which two-digit years are interpreted as
falling in the next century. The default value is 50. You can use
TwoDigitYearCenturyWindow to extend the life of legacy applications
that are tied to two-digit-year data entry; but the best solution is
to require four-digit input for years.

As I understand it, this is a variable internal to your Delphi app.
Other formatting vars are stored in the Windows registry where you can
set them outside of the app. If your app uses the StrToDate or
DateTime routines, [which it almost certainly does for date entry],
the app will send a four digit year to the BDE, or an integer date
code with the year already set. This is probably why you have not been
able to make any difference with BDE settings.

The only workaround that comes to mind is to have the users always
enter the year as four digits. Depending on how the date entry
controls were set up by the programmer, they might take a four digit
year. My programs all will allow the user to enter a two or four digit
year, and the full four digit entry overrides the century window
setting. [BTW, the value of the 'pivot' year can by made settable by
the user if this makes good sense in an individual application.]


HTH,
Dan
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> comp.lang.pascal.delphi.databases All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.