5

The LA Fox Developer Newsletter
March 1996
FOXPRO 2000 and Beyond
by Gunter C. Mayer CompuServeID: 74163,2215

A patch for the PC Systems Date and a Function to control the
limits of Foxpro Date Handling after Y-1 999.

By now most FP Developers must have heard or read tidbits of
grave Millennium Warnings concerning Y-2000 Date Handling,
all super alarming, but ALL without specific answers. Having
authored two very Date sensitive Applications, which are in
intense daily use, I naturally started to wonder how this would
affect my life on New Years Day 2000. Like do I have to stick
around??

So I decided to spend some time on this subject and came up
with some very interesting discoveries AND a clean solution, in
the form of a Date Function MCDATEO, which I want to share.

1.0 DEFINING THE PROBLEMS
FP Applications written in 2.5, 2.6 and Visual Foxpro all share
the same Date Processing Fundamentals embedded in its
Functions and Defaults. Here are the main areas of concern:
1.
The PC Sys Clock Y-2000 Date quirks migrating to
the FP Date() Function.
2.
The FP embedded, non-programmable Century
Default of 1900- 1999.
3.
“Set Century” dominance over the size of Dateboxes,
ignoring Picture Clauses.
4.
Performance and Century Range of FP Date Func-
tions.
5.
Handling of current Transaction Dates (Systems
Date), versus “historical” Dates, which would fall outside the FP
Default Century.

1.1
Pc Systems Date
It has been alarmingly reported, that the PC World, as we know
it, will come to an end at midnight Dec. 31, 1999, with 99% of
present day PC’s going nuts, especially when the power is off.
The problem lies with the CMOS Clock Chip and in the DOS!
Windows OP Systems, which sound-ed fatal to me, until I found
YEAR2000.ZIP on the Web.

It contains YEAR2000.TXT and YEAR2000. EXE, which patches
the transition flaw. I installed and tested it and it works. Thanks
to GT Becker, Dallas TX.

1.2
Set Century [ON/OFF]:
My conclusion: Set Century introduces complications that can
be avoided. The most important feature here is that this switch
primarily affects the Format of recording of Date Entries, the
Date Entry Format and the attachment of the Century Indicator
to the Date, whether the actual or the FP Default Century
Indicator is attached. Did you know that this setting also over
rides your Picture Clauses of Date Boxes?

OFF: Records the Date in [MM/DDIYY] Format. FP adds its
embedded Default Century Indicator of 1900- 1999 as if there
was no tomorrow , and it also ignores any Century Indicator
added to the Date Entry. When later set to ON, all Years
default to the 20th Century Indicator, thusthe Year [/21] will
become 1921.

ON: Records the Date in [MM/DD/CCYY] Format. When later
set to OFF, the display Format becomes [MM/DD/YY], but the
actual, not the default Century Indicator, is used in Date Calcu-
lations.

1.3 Picture Clauses:
Here is the first Grande Surpriso for me!

They are totally ignored when displaying an © GET {DATE}
Field. FP crudely pops its default Date Box Size onto your form.
OFF furnishes an 8 digit, ON a 10 digit Date Box, adding that
almighty 2 digit Century Indicator without regard to Real Estate
crowding or overlap. For example...
Set Century ON.
@GET dDATE Pict ‘99/99/99’
Bingo, the resulting display is ‘MM/DD/CCYY.

Conclusion: Without a Function, some major rework might be
required here! This has a definite affect on your Screen Real
Estate. For specific [CCYY] Date Entries I may have to [Set
Cent ON] before the @ GET.

1.4 Century Ranges of FP Date Functions
To start with, a refresher of the confusing Century Date Ranges
of Foxpro Date Commands, and later an individual look at
things.


2.0 Review of DP Date Functions
2.1 Foxpro Systems Date [DATEO]:
It takes its values from the internal PC Date Clock. It can NOT
be changed from within FP, but no problem, our little EXE File
has this one handled OK.

2.2 Date Functions (Assuming the 20th Century):
In my opinion, FP has over restricted some of the flexibility that
might be expected by developers. The Default Century Indicator
(100 year Range) should be programmable in the Config.FP
File, for example 1950 to 2049 and it definitely should stay the
heck out of my picture clauses. After testing, I created two
categories for these Puppies:

( Con’t, page 6)
Page 5

5